[Haskell-cafe] Current research on overlapping/closed type families?

Dan Weston westondan at imageworks.com
Fri Jan 23 22:12:49 EST 2009


Would this then also eventually work?

data Zero
data Succ a = Succ a

type family IsFunction f

type instances
   IsFunction (a -> b) = Succ (IsFunction b)
   IsFunction c        = Zero


Simon Peyton-Jones wrote:
> Provided all the overlapping instances are supplied together, as you suggest, I think what you say makes perfect sense and does not threaten soundness.
> 
> But we have not yet implemented the idea yet.  First priority is to get type families working properly, and in conjunction with type classes.  Then we can move on to adding features.
> 
> Simon
> 
> | -----Original Message-----
> | From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-
> | bounces at haskell.org] On Behalf Of Ryan Ingram
> | Sent: 19 January 2009 23:24
> | To: Haskell Cafe
> | Subject: [Haskell-cafe] Current research on overlapping/closed type families?
> |
> | What's the status of overlapping/closed type families?  I'm interested
> | in something like the following, which can currently be implemented in
> | GHC with Oleg-magic using functional dependencies, but cannot, to my
> | knowledge, be implemented with type families:
> |
> | data HTrue = HTrue
> | data HFalse = HFalse
> |
> | type family IsFunction f
> |
> | {- not legal in GHC6.10 -}
> | type instances
> |    IsFunction (a -> b) = HTrue
> |    IsFunction a = HFalse
> |
> |   -- ryan
> | _______________________________________________
> | Haskell-Cafe mailing list
> | Haskell-Cafe at haskell.org
> | http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 




More information about the Haskell-Cafe mailing list