{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
module Text.Appar.Input where
import qualified Data.ByteString.Char8 as S
import qualified Data.ByteString.Lazy.Char8 as L
class Eq inp => Input inp where
car :: inp -> Char
cdr :: inp -> inp
nil :: inp
isNil :: inp -> Bool
instance Input S.ByteString where
car = S.head
cdr = S.tail
nil = S.empty
isNil = S.null
instance Input L.ByteString where
car = L.head
cdr = L.tail
nil = L.empty
isNil = L.null
instance Input String where
car = head
cdr = tail
isNil = null
nil = ""