Lambda for type expressions in Haskell?

后端 未结 7 594
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 10:34

Does Haskell, or a specific compiler, have anything like type-level lambdas (if that\'s even a term)?

To elaborate, say I have a parametrized type Foo a b

7条回答
  •  死守一世寂寞
    2020-12-01 11:22

    From TypeCompose:

    newtype Flip (~>) b a = Flip { unFlip :: a ~> b }
    

    http://hackage.haskell.org/packages/archive/TypeCompose/0.6.3/doc/html/Control-Compose.html#t:Flip

    Also, if something is a Functor in two arguments, you can make it a bifunctor:

    http://hackage.haskell.org/packages/archive/category-extras/0.44.4/doc/html/Control-Bifunctor.html

    (or, in a later category-extras, a more general version: http://hackage.haskell.org/packages/archive/category-extras/0.53.5/doc/html/Control-Functor.html#t:Bifunctor)

提交回复
热议问题