[Haskell-cafe] manage effects in a DSL

David Thomas davidleothomas at gmail.com
Mon Feb 10 17:38:47 UTC 2014

I think what we're running into is a slight mismatch between a natural
understanding of types-as-sets and types-as-ADTs.  In the former sense -
particularly about things we're used to thinking of as sets (say, Integer)
- we want to be able to say "this is still integers, we just want to couple
them with this operation and get a monoid here, and that operation and get
a different monoid over there, but the objects are all still integers".
Viewed as ADTs, it's more intuitive to say "there is some data here behind
this interface, and the combination yields a single type", and that's what
we're doing with typeclasses in Haskell.  I don't *think* there is actually
a need to express the former more directly, and I'm not convinced there's a
way to do it that's actually cleaner, but I think that's the origin of the
impulse (and I don't think the impulse itself is "wrong" - you just need to
remember the translation).

On Mon, Feb 10, 2014 at 9:16 AM, Brandon Allbery <allbery.b at gmail.com>wrote:

> On Mon, Feb 10, 2014 at 11:26 AM, Dominique Devriese <
> dominique.devriese at cs.kuleuven.be> wrote:
>> I disagree. Just think about the Ord type class.  A decidable order
>> relation for a type is definitely something I would consider a clear
>> semantical meaning, but different sensible instances can be defined
>> for many types...  The same thing goes for Eq or Monoid or MonadState
>> or...
> Sure... but now you have to make sure everything agrees about it. The way
> you do this in Haskell is to give your custom instance a distinct type to
> go with it. (Now go look at the Sum and Product monoids).
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140210/200079f8/attachment.html>

More information about the Haskell-Cafe mailing list