Hoogle Search

Within LTS Haskell 24.35 (ghc-9.10.3)

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

  1. enumFromThenTo :: Enum a => a -> a -> a -> [a]

    hledger-web Hledger.Web.Import

    Used in Haskell's translation of [n,n'..m] with [n,n'..m] = enumFromThenTo n n' m, a possible implementation being enumFromThenTo n n' m = worker (f x) (c x) n m, x = fromEnum n' - fromEnum n, c x = bool (>=) ((x 0)

    f n y
    | n > 0 = f (n - 1) (succ y)
    | n < 0 = f (n + 1) (pred y)
    | otherwise = y
    
    
    and
    worker s c v m
    | c v m = v : worker s c (s v) m
    | otherwise = []
    
    

    Examples

    • enumFromThenTo 4 2 -6 :: [Integer] =
      [4,2,0,-2,-4,-6]
    • enumFromThenTo 6 8 2 :: [Int] = []

  2. enumFromTo :: Enum a => a -> a -> [a]

    hledger-web Hledger.Web.Import

    Used in Haskell's translation of [n..m] with [n..m] = enumFromTo n m, a possible implementation being

    enumFromTo n m
    | n <= m = n : enumFromTo (succ n) m
    | otherwise = []
    
    

    Examples

    • enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
    • enumFromTo 42 1 :: [Integer] = []

  3. enumDeltaInteger :: forall (m :: Type -> Type) . Monad m => Integer -> Integer -> Stream m Integer

    leveldb-haskell Data.Stream.Monadic

    Like fromList ([n,n+d..] :: [Integer]) but avoids allocating a list

  4. enumFromToChar :: forall (m :: Type -> Type) . Monad m => Char -> Char -> Stream m Char

    leveldb-haskell Data.Stream.Monadic

    Like fromList ([n..m] :: [Char]) but avoids allocating a list

  5. enumFromToInt :: forall (m :: Type -> Type) . Monad m => Int -> Int -> Stream m Int

    leveldb-haskell Data.Stream.Monadic

    Like fromList ([n..m] :: [Int]) but avoids allocating a list

  6. enumDirective :: DirectiveConstraint a => TypeName -> a -> DirectiveUsages

    morpheus-graphql-server Data.Morpheus.Server.Types

    No documentation available.

  7. enumDirective' :: DirectiveConstraint a => Name -> a -> DirectiveUsages

    morpheus-graphql-server Data.Morpheus.Server.Types

    No documentation available.

  8. enumFromField :: EnumMapper sqlEnum haskellSum -> FromField sqlEnum haskellSum

    opaleye Opaleye.Experimental.Enum

    No documentation available.

  9. enumMapper :: String -> (String -> Maybe haskellSum) -> (haskellSum -> String) -> EnumMapper sqlEnum haskellSum

    opaleye Opaleye.Experimental.Enum

    Create a mapping between a Postgres ENUM type and a Haskell type. Also works for DOMAIN types. For example, if you have the following ENUM

    CREATE TYPE public.mpaa_rating AS ENUM (
    'G',
    'PG',
    'PG-13',
    'R',
    'NC-17'
    );
    
    then you can define data types to represent the enum on the SQL side and Haskell side respectively
    data SqlRating
    data Rating = G | PG | PG13 | R | NC17 deriving Show
    
    and functions to map between them
    toSqlRatingString :: Rating -> String
    toSqlRatingString r = case r of
    G    -> "G"
    PG   -> "PG"
    PG13 -> "PG-13"
    R    -> "R"
    NC17 -> "NC-17"
    
    fromSqlRatingString :: String -> Maybe Rating
    fromSqlRatingString s = case s of
    "G"     -> Just G
    "PG"    -> Just PG
    "PG-13" -> Just PG13
    "R"     -> Just R
    "NC-17" -> Just NC17
    _       -> Nothing
    
    Then you can use the mappings as follows
    import qualified Opaleye as O
    import qualified Data.Profunctor.Product.Default as D
    
    sqlRatingMapper :: EnumMapper SqlRating Rating
    sqlRatingMapper = enumMapper "mpaa_rating" fromSqlRatingString toSqlRatingString
    
    instance O.DefaultFromField SqlRating Rating where
    defaultFromField = enumFromField sqlRatingMapper
    
    instance rating ~ Rating
    => D.Default (Inferrable O.FromField) SqlRating rating where
    def = inferrableDef
    
    instance D.Default O.ToFields Rating (O.Field SqlRating) where
    def = enumToFields sqlRatingMapper
    
    instance IsSqlType SqlRating where
    showSqlType = enumShowSqlType sqlRatingMapper
    

  10. enumMapperWithSchema :: String -> String -> (String -> Maybe haskellSum) -> (haskellSum -> String) -> EnumMapper sqlEnum haskellSum

    opaleye Opaleye.Experimental.Enum

    No documentation available.

Page 80 of many | Previous | Next