HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulevinyl-0.14.3Haskell2010

Data.Vinyl.Curry

Provides combinators for currying and uncurrying functions over arbitrary vinyl records.

  • 2 classes
  • 6 values
  • Packagevinyl-0.14.3
  • Exports11
  • LanguageHaskell2010
  • LicenceMIT
  • SourceCurry.hs

Currying

2 declarations
classclass RecordCurry (ts :: [u]) where
#

Methods

  • rcurry :: (Rec f ts -> a) -> CurriedF f ts a

    N-ary version of curry over functorial records.

    Example specialized signatures:

     rcurry :: (Rec Maybe '[Int, Double] -> Bool) -> Maybe Int -> Maybe Double -> Bool
     rcurry :: (Rec (Either Int) '[Double, String, ()] -> Int) -> Either Int Double -> Either Int String -> Either Int () -> Int
     rcurry :: (Rec f '[] -> Bool) -> Bool
     
Instances2RecordCurry
classclass RecordCurry' (ts :: [Type]) where
#

Methods

  • rcurry' :: (Rec Identity ts -> a) -> Curried ts a

    N-ary version of curry over pure records.

    Example specialized signatures:

     rcurry' :: (Rec Identity '[Int, Double] -> Bool) -> Int -> Double -> Bool
     rcurry' :: (Rec Identity '[Double, String, ()] -> Int) -> Double -> String -> () -> Int
     rcurry' :: (Rec Identity '[] -> Bool) -> Bool
     
Instances2RecordCurry'

Uncurrying

4 declarations
valueruncurry :: CurriedF f ts a -> Rec f ts -> a
#

N-ary version of uncurry over functorial records.

Example specialized signatures:

runcurry :: (Maybe Int -> Maybe Double -> String) -> Rec Maybe '[Int, Double] -> String
runcurry :: (IO FilePath -> String) -> Rec IO '[FilePath] -> String
runcurry :: Int -> Rec f '[] -> Int
valueruncurry' :: Curried ts a -> Rec Identity ts -> a
#

N-ary version of uncurry over pure records.

Example specialized signatures:

runcurry' :: (Int -> Double -> String) -> Rec Identity '[Int, Double] -> String
runcurry' :: Int -> Rec Identity '[] -> Int

Example usage:

f :: Rec Identity '[Bool, Int, Double] -> Either Int Double
f = runcurry' $ b x y -> if b then Left x else Right y

Applicative Combinators

2 declarations
valueruncurryA' :: Applicative f => Curried ts a -> Rec f ts -> f a
#

Lift an N-ary function to work over a record of Applicative computations.

Example1 expression
runcurryA' (+) (Just 2 :& Just 3 :& RNil)Just 5
Example1 expression
runcurryA' (+) (Nothing :& Just 3 :& RNil)Nothing

Curried Function Types

3 declarations
familytype family Curried (ts :: [Type]) a where
#

For the list of types ts, Curried ts a is a curried function type from arguments of types in ts to a result of type a.

Example1 expression
:kind! Curried '[Int, Bool, String] IntCurried '[Int, Bool, String] Int :: *= Int -> Bool -> [Char] -> Int

Equations

familytype family CurriedF (f :: u -> Type) (ts :: [u]) a where
#

For the type-level list ts, CurriedF f ts a is a curried function type from arguments of type f t for t in ts, to a result of type a.

Example1 expression
:kind! CurriedF Maybe '[Int, Bool, String] IntCurriedF Maybe '[Int, Bool, String] Int :: *= Maybe Int -> Maybe Bool -> Maybe [Char] -> Int

Equations

familytype family CurriedX (f :: u -> Type) (ts :: [u]) a where
#

For the type-level list ts, CurriedX f ts a is a curried function type from arguments of type HKD f t for t in ts, to a result of type a.

Example2 expressions
:set -XTypeOperators:kind! CurriedX (Maybe :. Identity) '[Int, Bool, String] IntCurriedX (Maybe :. Identity) '[Int, Bool, String] Int :: *= Maybe Int -> Maybe Bool -> Maybe [Char] -> Int

Equations