[Haskell-cafe] Tupling functions
cam at uptoisomorphism.net
Thu Sep 15 15:37:22 CEST 2011
On Thu, Sep 15, 2011 at 7:51 AM, Markus Läll <markus.l2ll at gmail.com> wrote:
> Intuitively it seems to be exactly the same as the type families'
> aproach, and looks quite clear too.
Not exact, no--as written, it's strictly more powerful. Your fundeps
go in both directions, whereas the type families didn't (though could
easily be extended to do so, if desired, at the cost of some extra
verbosity). The main argument in favor of type families here is the ~
equality constraint which, as you've found, works in combination with
fundeps as well. :] You can actually simulate it with fundeps alone,
but you probably don't want to.
All else equal I personally find type families easier to work with,
but in this case the difference is minimal. For bidirectional
constraints and simple transformations, fundeps are probably a bit
nicer, so in hindsight I think yours is the better idea here.
More information about the Haskell-Cafe