[Haskell-cafe] Kind product

Gautier DI FOLCO gautier.difolco at gmail.com
Sun Nov 30 00:43:19 UTC 2014


Hello all,

I have the following code:
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}

data Branch = Left | Right

type family Product (v :: Branch) (a :: k) (b :: k) :: k where
  Product Left  l r = l
  Product Right l r = r

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

Is it possible to do such a thing?
If not I can find a solution with Kind families/Kind pattern matching, but
I don't think that exists, am I wrong?

Thanks in advance for your help,
Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141130/94f10984/attachment.html>


More information about the Haskell-Cafe mailing list