
14 Aug
2009
14 Aug
'09
9:10 p.m.
Michael P Mossey wrote:
Michael P Mossey wrote:
In Martin Grabmuller's tutorial "Monad Transformers Step by Step", found here
Additional question: in this paper he uses a data constructor in an interesting way: back-quoting it to make it an operator. I thought, "Huh, a constructor is a lot like a function?" I did some experiments and found that I can map a constructor over a list and I can compose a constructor with other functions. Cool. So is a constructor a function, in every sense?
Yes. In expressions, a constructor is a function, no more and no less (albeit with some weird capitalization). Constructors however, can *also* be used in pattern-matching, unlike functions. That's the (only?) special thing about them. -Isaac