Hoogle Search

Within LTS Haskell 24.32 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. genFromJSONEnum :: Name -> Q [Dec]

    aeson-schemas Data.Aeson.Schema.TH

    Generate an instance of FromJSON for the given data type. Prefer using mkEnum; this function is useful for data types in which you want greater control over the actual data type. The FromJSON instance will match to a string value matching the constructor name, case-insensitive.

    data State = Open | CLOSED deriving (Show,Enum)
    genFromJSONEnum ''State
    
    -- outputs:
    --   Just Open
    --   Just Open
    --   Just CLOSED
    --   Just CLOSED
    main = mapM_ print
    [ decodeState "open"
    , decodeState "OPEN"
    , decodeState "closed"
    , decodeState "CLOSED"
    ]
    where
    decodeState :: String -> Maybe State
    decodeState = decode . show
    
    

  2. genToJSONEnum :: Name -> Q [Dec]

    aeson-schemas Data.Aeson.Schema.TH

    Generate an instance of ToJSON for the given data type. Prefer using mkEnum; this function is useful for data types in which you want greater control over the actual data type. The ToJSON instance will encode the enum as a string matching the constructor name.

    data State = Open | CLOSED deriving (Show,Enum)
    genToJSONEnum ''State
    
    -- outputs:
    --   "Open"
    --   "CLOSED"
    main = mapM_ print
    [ encode Open
    , encode CLOSED
    ]
    
    

  3. mkEnum :: String -> [String] -> Q [Dec]

    aeson-schemas Data.Aeson.Schema.TH

    Make an enum type with the given constructors, that can be parsed from JSON. The FromJSON instance will match to a string value matching the constructor name, case-insensitive.

    mkEnum "State" ["OPEN", "CLOSED"]
    
    -- generates equivalent of:
    --   data State = OPEN | CLOSED deriving (...)
    --   genFromJSONEnum ''State
    --   genToJSONEnum ''State
    
    

  4. getRateNumden :: T i y (Word, Word)

    alsa-pcm Sound.ALSA.PCM.Parameters.Hardware

    No documentation available.

  5. oneNum :: Num a => a -> a

    backprop Numeric.Backprop.Class

    one for instances of Num. Is lazy in its argument.

  6. c'GLFW_INVALID_ENUM :: Num a => a

    bindings-GLFW Bindings.GLFW

    No documentation available.

  7. stackFrame_lineNumber :: StackFrame -> Int

    bugsnag-hs Network.Bugsnag

    The line of the file that this frame of the stack was in.

  8. fromEnum :: Enum a => a -> Int

    cabal-install-solver Distribution.Solver.Compat.Prelude

    Convert to an Int. It is implementation-dependent what fromEnum returns when applied to a value that is too large to fit in an Int.

  9. toEnum :: Enum a => Int -> a

    cabal-install-solver Distribution.Solver.Compat.Prelude

    Convert from an Int.

  10. fromEnum :: Enum a => a -> Int

    clash-prelude Clash.HaskellPrelude

    Convert to an Int. It is implementation-dependent what fromEnum returns when applied to a value that is too large to fit in an Int.

Page 168 of many | Previous | Next