Coder Social home page Coder Social logo

range's Introduction

range - by Robert Massaioli

build-status haskell

The range library is written in Haskell and it's purpose is to make it easy to deal with ranges. For example you may have the following ranges:

1-4, 6-23, 15-50, 90-

And you are given a value x, how do you know if the value x is in those ranges? That is the question that this library answers. You just load your ranges using the library and then you can query to see if values exist inside your ranges. This library aims to be as efficient as light as possible while still being useful.

Example Code

Here is a small example program written using this library:

module Main where

import Data.Range.Range

putStatus :: Bool -> String -> IO ()
putStatus result test = putStrLn $ "[" ++ (show result) ++ "] " ++ test

main = do
    inRanges [SingletonRange 4]   4                         `putStatus` "Singletons Match"
    inRanges [0 +=+ 10] 7                                   `putStatus` "Value in Range"
    inRanges [LowerBoundRange (Bound 80 Inclusive)] 12345   `putStatus` "Value in Long Range"
    inRanges [InfiniteRange]      8287423                   `putStatus` "Value in Infinite Range"
    inRanges [lbi 50, 1 +=+ 30] 44                          `putStatus` "NOT in Composite Range (expect false)"

If you wish to see a better example in a real program then you should check out splitter.

Installation Instructions

You can install the range library in the standard way that you install any other Haskell library: using Cabal. I have uploaded this package to Hackage so you can get it by:

cabal install range

If you wish to install it from source then check out this repository and do the following:

cd /path/to/haskell/range
cabal install

You may also wish to work on this library in a development environment, in which case you should run:

cd /path/to/haskell/range
cabal-dev install

And that is all that there is to it. I hope you enjoy using this library and make great projects with it.

range's People

Contributors

robertmassaioli avatar srijs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.