[Haskell-cafe] Mild confusion around type family
eir at cis.upenn.edu
Fri Jun 19 18:28:47 UTC 2015
On Jun 19, 2015, at 10:14 AM, "Nicholls, Mark" <nicholls.mark at vimn.com> wrote:
>> type family Sub a b where
>> -- a - 0 == a
>> Sub a Z = a
>> -- (a + 1) - (b + 1) == a - b
>> Sub (S a) (S b) = Sub a b
With a closed family, you could always do something like this:
> type family Error (msg :: Symbol) -- no instances!
> type family Sub a b where
> -- real work
> Sub a b = Error "Sub is undefined here"
Would that help? It still doesn't immediately error (there's no way to do that currently), but it's perhaps more telling to have an error string.
More information about the Haskell-Cafe