7 import Data.Char (Char)
8 import Data.Function ((.), id)
9 import Data.Word (Word8)
10 import Prelude (Enum(..))
11 import Data.ByteString.Internal (w2c, c2w)
13 -- * Class 'CoerceEnum'
14 -- | Convenient helper to write generic grammars
15 -- consuming either 'Word8' or 'Char'.
16 class CoerceEnum a b where
18 default coerceEnum :: Enum a => Enum b => a -> b
19 coerceEnum = toEnum . fromEnum
20 instance CoerceEnum Word8 Char where
22 instance CoerceEnum Char Word8 where
24 instance CoerceEnum Char Char where