]> Git — Sourcephile - haskell/symantic-parser.git/blob - parsers/Parsers/Utils/Handrolled.hs
build: update `git-chglog` config
[haskell/symantic-parser.git] / parsers / Parsers / Utils / Handrolled.hs
1 {-# LANGUAGE TypeFamilies #-}
2 module Parsers.Utils.Handrolled where
3
4 import Data.Bool (Bool)
5 import Data.Char (Char)
6 import Data.Maybe (Maybe(..))
7 import Data.Word (Word8)
8 import qualified Data.ByteString as BS
9 import qualified Data.Text as T
10
11 -- * Class 'Inputable'
12 class Inputable inp where
13 type Token inp
14 null :: inp -> Bool
15 empty :: inp
16 uncons :: inp -> Maybe (Token inp, inp)
17 instance Inputable T.Text where
18 type Token T.Text = Char
19 null = T.null
20 empty = T.empty
21 uncons = T.uncons
22 instance Inputable BS.ByteString where
23 type Token BS.ByteString = Word8
24 null = BS.null
25 empty = BS.empty
26 uncons = BS.uncons