Hoogle Search
Within LTS Haskell 24.28 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
derivePathInfo :: Name -> Q [Dec]web-routes-th Web.Routes.TH use Template Haskell to create PathInfo instances for a type.
$(derivePathInfo ''SiteURL)
Uses the standard formatter by default.derivePathInfo' :: (String -> String) -> Name -> Q [Dec]web-routes-th Web.Routes.TH use Template Haskell to create PathInfo instances for a type. This variant allows the user to supply a function that transforms the constructor name to a prettier rendering. It is important that the transformation function generates a unique output for each input. For example, simply converting the string to all lower case is not acceptable, because then FooBar and Foobar would be indistinguishable.
$(derivePathInfo' standard ''SiteURL)
see also: standardderivePersistField :: String -> Q [Dec]classy-prelude-yesod ClassyPrelude.Yesod Automatically creates a valid PersistField instance for any datatype that has valid Show and Read instances. Can be very convenient for Enum types.
derivePersistFieldJSON :: String -> Q [Dec]classy-prelude-yesod ClassyPrelude.Yesod Automatically creates a valid PersistField instance for any datatype that has valid ToJSON and FromJSON instances. For a datatype T it generates instances similar to these:
instance PersistField T where toPersistValue = PersistByteString . L.toStrict . encode fromPersistValue = (left T.pack) . eitherDecodeStrict' <=< fromPersistValue instance PersistFieldSql T where sqlType _ = SqlString
deriveCPointed :: Name -> DecsQczipwith Data.CZipWith Derives a cPointed instance for a datatype of kind (* -> *) -> *. Requires that for this datatype (we shall call its argument f :: * -> * here)
- there is exactly one constructor;
- all fields in the one constructor are either of the form f x for some x or of the form X f for some type X where there is an instance cPointed X.
data A f = A { a_str :: f String , a_bool :: f Bool } data B f = B { b_int :: f Int , b_float :: f Float , b_a :: A f } derivecPointed ''A derivecPointed ''BThis produces the following instances:instance cPointed A where cPoint f = A f f instance cPointed B where cPoint f = B f f (cPoint f f)
deriveCZipWith :: Name -> DecsQczipwith Data.CZipWith Derives a CZipWith instance for a datatype of kind (* -> *) -> *. Requires that for this datatype (we shall call its argument f :: * -> * here)
- there is exactly one constructor;
- all fields in the one constructor are either of the form f x for some x or of the form X f for some type X where there is an instance CZipWith X.
data A f = A { a_str :: f String , a_bool :: f Bool } data B f = B { b_int :: f Int , b_float :: f Float , b_a :: A f } deriveCZipWith ''An deriveCZipWith ''BThis produces the following instances:instance CZipWith A where cZipWith f (A x1 x2) (A y1 y2) = A (f x1 y1) (f x2 y2) instance CZipWith B wheren cZipWith f (B x1 x2 x3) (B y1 y2 y3) = B (f x1 y1) (f x2 y2) (cZipWith f x3 y3)
deriveCZipWithM :: Name -> DecsQczipwith Data.CZipWith Derives a CZipWithM instance for a datatype of kind (* -> *) -> *. Requires that for this datatype (we shall call its argument f :: * -> * here)
- there is exactly one constructor;
- all fields in the one constructor are either of the form f x for some x or of the form X f for some type X where there is an instance CZipWithM X.
data A f = A { a_str :: f String , a_bool :: f Bool } data B f = B { b_int :: f Int , b_float :: f Float , b_a :: A f } deriveCZipWithM ''A deriveCZipWithM ''BThis produces the following instances:instance CZipWithM A where cZipWithM f (A x1 x2) (A y1 y2) = A <$> f x1 y1 <*> f x2 y2 instance CZipWith B where cZipWithM f (B x1 x2 x3) (B y1 y2 y3) = B <$> f x1 y1 <*> f x2 y2 <*> cZipWithM f x3 y3
deriveCsvViaSci :: Name -> Q [Dec]detour-via-sci Data.Via.Scientific Similar to deriveJsonViaSci but for instances of ToField and FromField.
>>> deriveCsvViaSci ''Lat ...
deriveDecimalPlaces :: DecimalPlaces -> Name -> Q [Dec]detour-via-sci Data.Via.Scientific Taking a number of decimal places from the given DecimalPlaces newtype, derives an instance of DefaultDecimalPlaces.
>>> deriveDecimalPlaces (DecimalPlaces 8) ''Lat ...
deriveJsonViaSci :: Name -> Q [Dec]detour-via-sci Data.Via.Scientific Derives an instance of ToJSON wrapping the value with ViaSci before encoding. Similarly the value is decoded as ViaSci and then unwrapped in the derived instance of FromJSON.
>>> deriveJsonViaSci ''Lat ...