Re: [Haskell-cafe] Type-level GCD [Instance Chains]

1 Jun
2017
1 Jun
'17
1:01 p.m.
On Thu Jun 1 12:44:32 UTC 2017, Anthony Clayden wrote:
For example, consider the simple chain:
class C t u where f :: t -> u instance C Int Int where f = M else C t u where f = N
Ah, silly me. There's a neater way to achieve that.
I think Instance Guards both have less lexical clutter, and help the compiler see what's coherent:
instance C Int Int where f = M instance C t u | (t, u) /~ (Int, Int) where f = N
AntC
2958
Age (days ago)
2958
Last active (days ago)
0 comments
1 participants
participants (1)
-
Anthony Clayden