mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
11 lines
256 B
Haskell
11 lines
256 B
Haskell
|
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
|