module EVP.Internal where type Name = String data Error = Missing Name | ParseError Name String String | CustomError String deriving Int -> Error -> ShowS [Error] -> ShowS Error -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Error] -> ShowS $cshowList :: [Error] -> ShowS show :: Error -> String $cshow :: Error -> String showsPrec :: Int -> Error -> ShowS $cshowsPrec :: Int -> Error -> ShowS Show data ScanF a = ScanF { forall a. ScanF a -> String name :: Name , forall a. ScanF a -> Maybe String -> Either Error (String, a) parser :: Maybe String -> Either Error (String, a) , forall a. ScanF a -> Maybe String metavar :: Maybe String } deriving forall a b. a -> ScanF b -> ScanF a forall a b. (a -> b) -> ScanF a -> ScanF b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: forall a b. a -> ScanF b -> ScanF a $c<$ :: forall a b. a -> ScanF b -> ScanF a fmap :: forall a b. (a -> b) -> ScanF a -> ScanF b $cfmap :: forall a b. (a -> b) -> ScanF a -> ScanF b Functor data Scan a where Pure :: a -> Scan a Scan :: ScanF a -> Scan (a -> b) -> Scan b Group :: String -> Scan a -> Scan a instance Functor Scan where fmap :: forall a b. (a -> b) -> Scan a -> Scan b fmap a -> b f (Pure a a) = forall a. a -> Scan a Pure (a -> b f a a) fmap a -> b f (Scan ScanF a k Scan (a -> a) c) = forall a b. ScanF a -> Scan (a -> b) -> Scan b Scan ScanF a k (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap (a -> b f.) Scan (a -> a) c) fmap a -> b f (Group String name Scan a s) = forall a. String -> Scan a -> Scan a Group String name forall a b. (a -> b) -> a -> b $ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap a -> b f Scan a s instance Applicative Scan where pure :: forall a. a -> Scan a pure = forall a. a -> Scan a Pure Pure a -> b f <*> :: forall a b. Scan (a -> b) -> Scan a -> Scan b <*> Scan a k = a -> b f forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Scan a k Scan ScanF a k Scan (a -> a -> b) c <*> Scan a r = forall a b. ScanF a -> Scan (a -> b) -> Scan b Scan ScanF a k (forall a b c. (a -> b -> c) -> b -> a -> c flip forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Scan (a -> a -> b) c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Scan a r) Group String name Scan (a -> b) s <*> Scan a r = forall a. String -> Scan a -> Scan a Group String name (Scan (a -> b) s forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Scan a r)