[Haskell-cafe] Kind product

Andres Löh andres.loeh at gmail.com
Sun Nov 30 09:57:56 UTC 2014


Hi.

[...]

> My goal is to have a thing like that:
> type family Product (v :: Branch) (a :: k1) (b :: k2) :: (Either k1 k2)
> where

I'm not sure what exactly it is that you want, but this code checks:

{-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-}
module PairEitherKinds where

data Branch = L | R

type family Product (s :: Branch) (a :: k1) (b :: k2) :: Either k1 k2 where
  Product L a b = Left  a
  Product R a b = Right b

Cheers,
  Andres


More information about the Haskell-Cafe mailing list