
19 Jun
2015
19 Jun
'15
2:28 p.m.
On Jun 19, 2015, at 10:14 AM, "Nicholls, Mark"
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. Richard