-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | To make a type corresponding to an enum of C language -- -- Please see the README on GitHub at -- https://github.com/YoshikuniJujo/c-enum#readme @package c-enum @version 0.1.1.0 module Foreign.C.Enum -- | Write like the following. -- --
-- enum Foo ''Int [''Show, ''Read, ''Eq] [ -- (FooError, - 1), -- (FooZero, 0), -- (FooOne, 1), -- (FooTwo, 2) ] ---- -- Then you get like the following. -- --
-- newtype Foo = Foo Int deriving Eq -- -- pattern FooError :: Int -> Foo -- pattern FooError <- Foo (- 1) where -- FooError = Foo (- 1) -- -- pattern FooZero :: Int -> Foo -- ... -- -- -- instance Show Foo where -- showsPrec = ... -- -- instance Read Foo where -- readPrec = ... ---- -- And you can read and show like the following. -- --
-- > Foo $ - 1 -- FooError -- > FooTwo -- FooTwo -- > Foo 3 -- Foo 3 -- > read "Foo (- 1)" :: Foo -- FooError -- > read "FooOne" :: Foo -- FooOne --enum :: String -> Name -> [Name] -> [(String, Integer)] -> DecsQ instance GHC.Show.Show Foreign.C.Enum.ShowReadClasses