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.
fromPersistValueEnum :: (Enum a, Bounded a) => PersistValue -> Either Text apersistent Database.Persist.Class.PersistEntity Convenience function for getting a free PersistField instance from a type with an Enum instance. This function also requires a Bounded instance to improve the reporting of errors. Example usage in combination with toPersistValueEnum:
data SeverityLevel = Low | Medium | Critical | High deriving (Enum, Bounded) instance PersistField SeverityLevel where fromPersistValue = fromPersistValueEnum toPersistValue = toPersistValueEnum
toPersistValueEnum :: Enum a => a -> PersistValuepersistent Database.Persist.Class.PersistEntity Convenience function for getting a free PersistField instance from a type with an Enum instance. The function derivePersistField from the persistent-template package should generally be preferred. However, if you want to ensure that an ORDER BY clause that uses your field will order rows by the data constructor order, this is a better choice. Example usage in combination with fromPersistValueEnum:
data SeverityLevel = Low | Medium | Critical | High deriving (Enum, Bounded) instance PersistField SeverityLevel where fromPersistValue = fromPersistValueEnum toPersistValue = toPersistValueEnum
choiceOptFromEnum :: (Bounded b, Enum b, Show b, Eq b) => MkOptDescr (a -> b) (b -> a -> a) aCabal Distribution.Simple.Command create a Choice option out of an enumeration type. As long flags, the Show output is used. As short flags, the first character which does not conflict with a previous one is used.
OptionEnum :: [String] -> OptionTypeCabal Distribution.TestSuite No documentation available.
parseBoundedEnumOf :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text ahttp-api-data Web.HttpApiData Parse values based on a precalculated mapping of their Text representation.
>>> parseBoundedEnumOf toUrlPiece "true" :: Either Text Bool Right True
For case insensitive parser see parseBoundedEnumOfI.parseBoundedEnumOfI :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text ahttp-api-data Web.HttpApiData Case insensitive. Parse values case insensitively based on a precalculated mapping of their Text representations.
>>> parseBoundedEnumOfI toUrlPiece "FALSE" :: Either Text Bool Right False
For case sensitive parser see parseBoundedEnumOf.lookupBoundedEnumOf :: (Bounded a, Enum a, Eq b) => (a -> b) -> b -> Maybe ahttp-api-data Web.Internal.HttpApiData Lookup values based on a precalculated mapping of their representations.
parseBoundedEnumOf :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text ahttp-api-data Web.Internal.HttpApiData Parse values based on a precalculated mapping of their Text representation.
>>> parseBoundedEnumOf toUrlPiece "true" :: Either Text Bool Right True
For case insensitive parser see parseBoundedEnumOfI.parseBoundedEnumOfI :: (Bounded a, Enum a) => (a -> Text) -> Text -> Either Text ahttp-api-data Web.Internal.HttpApiData Case insensitive. Parse values case insensitively based on a precalculated mapping of their Text representations.
>>> parseBoundedEnumOfI toUrlPiece "FALSE" :: Either Text Bool Right False
For case sensitive parser see parseBoundedEnumOf.MaxFileNumberExceeded :: Int -> RequestParseExceptionwai-extra Network.Wai.Parse No documentation available.