On Wednesday, March 15, 2017 at 11:06:19 PM UTC, Brian Marick wrote:
>
> I don’t quite understand what you’re saying. Do you have examples of how I 
> might go astray? Or how I’ve already gone astray in the available chapter 
> on Maybe? https://leanpub.com/outsidefp
>
> (Part of my confusion is that it seems to me that 
> maybe-is-a-data-structure is the way most programmers would reflexively 
> look at it. That is: “a functor is a wrapper”.)
>

Had a look and was encouraged to see a section headed "Maybe.map and 
pipelines of iffy computations" coming into it at about the earliest point 
you could bring up the topic. Although Maybe is a data structure, I think 
it makes sense to discuss its special role in computations that may fail 
ahead of discussing its use or not in the context of data modelling. 

The reason being that programmers coming from languages with 'null' are 
likely to first think of it as a substitute for null. And start creating 
records with Maybe fields in them - more helpful to save a discussion of 
the use of Maybe in data modelling (or not) for when you are ready to 
discuss how to make illegal states unrepresentable. 

I started out the wrong way on this, and had to unlearn and refactor my 
code. Now I think of Maybe as being more like a light-weight exception or 
an early return statement, when comparing with imperative code.


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to