1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00
semantic/src/Range.hs

11 lines
256 B
Haskell
Raw Normal View History

2015-12-03 05:40:34 +03:00
module Range where
data Range = Range { start :: Int, end :: Int }
deriving (Eq, Show)
substring :: Range -> String -> String
substring range = take (end range - start range) . drop (start range)
instance Ord Range where
a <= b = start a <= start b