{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Language.Cimple.ParseResult ( ParseResult , toEither ) where newtype ParseResult a = ParseResult { ParseResult a -> Either String a toEither :: Either String a } deriving (a -> ParseResult b -> ParseResult a (a -> b) -> ParseResult a -> ParseResult b (forall a b. (a -> b) -> ParseResult a -> ParseResult b) -> (forall a b. a -> ParseResult b -> ParseResult a) -> Functor ParseResult forall a b. a -> ParseResult b -> ParseResult a forall a b. (a -> b) -> ParseResult a -> ParseResult b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: a -> ParseResult b -> ParseResult a $c<$ :: forall a b. a -> ParseResult b -> ParseResult a fmap :: (a -> b) -> ParseResult a -> ParseResult b $cfmap :: forall a b. (a -> b) -> ParseResult a -> ParseResult b Functor, Functor ParseResult a -> ParseResult a Functor ParseResult -> (forall a. a -> ParseResult a) -> (forall a b. ParseResult (a -> b) -> ParseResult a -> ParseResult b) -> (forall a b c. (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c) -> (forall a b. ParseResult a -> ParseResult b -> ParseResult b) -> (forall a b. ParseResult a -> ParseResult b -> ParseResult a) -> Applicative ParseResult ParseResult a -> ParseResult b -> ParseResult b ParseResult a -> ParseResult b -> ParseResult a ParseResult (a -> b) -> ParseResult a -> ParseResult b (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c forall a. a -> ParseResult a forall a b. ParseResult a -> ParseResult b -> ParseResult a forall a b. ParseResult a -> ParseResult b -> ParseResult b forall a b. ParseResult (a -> b) -> ParseResult a -> ParseResult b forall a b c. (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c forall (f :: * -> *). Functor f -> (forall a. a -> f a) -> (forall a b. f (a -> b) -> f a -> f b) -> (forall a b c. (a -> b -> c) -> f a -> f b -> f c) -> (forall a b. f a -> f b -> f b) -> (forall a b. f a -> f b -> f a) -> Applicative f <* :: ParseResult a -> ParseResult b -> ParseResult a $c<* :: forall a b. ParseResult a -> ParseResult b -> ParseResult a *> :: ParseResult a -> ParseResult b -> ParseResult b $c*> :: forall a b. ParseResult a -> ParseResult b -> ParseResult b liftA2 :: (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c $cliftA2 :: forall a b c. (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c <*> :: ParseResult (a -> b) -> ParseResult a -> ParseResult b $c<*> :: forall a b. ParseResult (a -> b) -> ParseResult a -> ParseResult b pure :: a -> ParseResult a $cpure :: forall a. a -> ParseResult a $cp1Applicative :: Functor ParseResult Applicative, Applicative ParseResult a -> ParseResult a Applicative ParseResult -> (forall a b. ParseResult a -> (a -> ParseResult b) -> ParseResult b) -> (forall a b. ParseResult a -> ParseResult b -> ParseResult b) -> (forall a. a -> ParseResult a) -> Monad ParseResult ParseResult a -> (a -> ParseResult b) -> ParseResult b ParseResult a -> ParseResult b -> ParseResult b forall a. a -> ParseResult a forall a b. ParseResult a -> ParseResult b -> ParseResult b forall a b. ParseResult a -> (a -> ParseResult b) -> ParseResult b forall (m :: * -> *). Applicative m -> (forall a b. m a -> (a -> m b) -> m b) -> (forall a b. m a -> m b -> m b) -> (forall a. a -> m a) -> Monad m return :: a -> ParseResult a $creturn :: forall a. a -> ParseResult a >> :: ParseResult a -> ParseResult b -> ParseResult b $c>> :: forall a b. ParseResult a -> ParseResult b -> ParseResult b >>= :: ParseResult a -> (a -> ParseResult b) -> ParseResult b $c>>= :: forall a b. ParseResult a -> (a -> ParseResult b) -> ParseResult b $cp1Monad :: Applicative ParseResult Monad) instance MonadFail ParseResult where fail :: String -> ParseResult a fail = Either String a -> ParseResult a forall a. Either String a -> ParseResult a ParseResult (Either String a -> ParseResult a) -> (String -> Either String a) -> String -> ParseResult a forall b c a. (b -> c) -> (a -> b) -> a -> c . String -> Either String a forall a b. a -> Either a b Left