{-# LINE 1 "src/Data/Emacs/Module/Env/ProcessInput.hsc" #-}
module Data.Emacs.Module.Env.ProcessInput
( Result(..)
, resultToNum
, resultFromNum
) where
import Data.Data (Data)
import Language.Haskell.TH.Syntax (Lift)
import Prettyprinter.Generics
data Result
= Continue
| Quit
deriving (Result -> Result -> Bool
(Result -> Result -> Bool)
-> (Result -> Result -> Bool) -> Eq Result
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Result -> Result -> Bool
== :: Result -> Result -> Bool
$c/= :: Result -> Result -> Bool
/= :: Result -> Result -> Bool
Eq, Eq Result
Eq Result =>
(Result -> Result -> Ordering)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Result)
-> (Result -> Result -> Result)
-> Ord Result
Result -> Result -> Bool
Result -> Result -> Ordering
Result -> Result -> Result
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Result -> Result -> Ordering
compare :: Result -> Result -> Ordering
$c< :: Result -> Result -> Bool
< :: Result -> Result -> Bool
$c<= :: Result -> Result -> Bool
<= :: Result -> Result -> Bool
$c> :: Result -> Result -> Bool
> :: Result -> Result -> Bool
$c>= :: Result -> Result -> Bool
>= :: Result -> Result -> Bool
$cmax :: Result -> Result -> Result
max :: Result -> Result -> Result
$cmin :: Result -> Result -> Result
min :: Result -> Result -> Result
Ord, Int -> Result -> ShowS
[Result] -> ShowS
Result -> String
(Int -> Result -> ShowS)
-> (Result -> String) -> ([Result] -> ShowS) -> Show Result
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Result -> ShowS
showsPrec :: Int -> Result -> ShowS
$cshow :: Result -> String
show :: Result -> String
$cshowList :: [Result] -> ShowS
showList :: [Result] -> ShowS
Show, Typeable Result
Typeable Result =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result -> c Result)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Result)
-> (Result -> Constr)
-> (Result -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Result))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Result))
-> ((forall b. Data b => b -> b) -> Result -> Result)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Result -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Result -> r)
-> (forall u. (forall d. Data d => d -> u) -> Result -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Result -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Result -> m Result)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result -> m Result)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result -> m Result)
-> Data Result
Result -> Constr
Result -> DataType
(forall b. Data b => b -> b) -> Result -> Result
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Result -> u
forall u. (forall d. Data d => d -> u) -> Result -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Result -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Result -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Result -> m Result
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result -> m Result
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Result
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result -> c Result
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Result)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Result)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result -> c Result
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result -> c Result
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Result
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Result
$ctoConstr :: Result -> Constr
toConstr :: Result -> Constr
$cdataTypeOf :: Result -> DataType
dataTypeOf :: Result -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Result)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Result)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Result)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Result)
$cgmapT :: (forall b. Data b => b -> b) -> Result -> Result
gmapT :: (forall b. Data b => b -> b) -> Result -> Result
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Result -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Result -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Result -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Result -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Result -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Result -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Result -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Result -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Result -> m Result
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Result -> m Result
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result -> m Result
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result -> m Result
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result -> m Result
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result -> m Result
Data, (forall x. Result -> Rep Result x)
-> (forall x. Rep Result x -> Result) -> Generic Result
forall x. Rep Result x -> Result
forall x. Result -> Rep Result x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Result -> Rep Result x
from :: forall x. Result -> Rep Result x
$cto :: forall x. Rep Result x -> Result
to :: forall x. Rep Result x -> Result
Generic, (forall (m :: * -> *). Quote m => Result -> m Exp)
-> (forall (m :: * -> *). Quote m => Result -> Code m Result)
-> Lift Result
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => Result -> m Exp
forall (m :: * -> *). Quote m => Result -> Code m Result
$clift :: forall (m :: * -> *). Quote m => Result -> m Exp
lift :: forall (m :: * -> *). Quote m => Result -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => Result -> Code m Result
liftTyped :: forall (m :: * -> *). Quote m => Result -> Code m Result
Lift)
instance Pretty Result where
pretty :: forall ann. Result -> Doc ann
pretty = Result -> Doc ann
forall a ann. (Generic a, GPretty (Rep a)) => a -> Doc ann
ppGeneric
{-# INLINE resultToNum #-}
resultToNum :: Num a => Result -> a
resultToNum :: forall a. Num a => Result -> a
resultToNum = \case
Result
Continue -> (a
0)
{-# LINE 34 "src/Data/Emacs/Module/Env/ProcessInput.hsc" #-}
Quit -> (1)
{-# LINE 35 "src/Data/Emacs/Module/Env/ProcessInput.hsc" #-}
{-# INLINE resultFromNum #-}
resultFromNum :: (Eq a, Num a) => a -> Maybe Result
resultFromNum :: forall a. (Eq a, Num a) => a -> Maybe Result
resultFromNum = \case
(a
0) -> Result -> Maybe Result
forall a. a -> Maybe a
Just Result
Continue
{-# LINE 40 "src/Data/Emacs/Module/Env/ProcessInput.hsc" #-}
(1) -> Just Quit
{-# LINE 41 "src/Data/Emacs/Module/Env/ProcessInput.hsc" #-}
_ -> Nothing