Magnus Lidbom

Magnus Lidbom Magnus Lidbom

Niner since 2009

Comments

  • C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 8 of 13

    I'm mystified by Erik's comment that the inserting calls to parse "makes the type conversion explicit".

     

    I can certainly see that:

    parse p "something"

    is preferable to

    p "something"

     

    However, to me it seems that it makes semantics exlicit rather than type conversion.

     

    Erik hardly seems more likely to be confused here than I am, so I think I'm missing some fundamental alternative way of viewing this.

     

    As I'm writing this I think I'm starting to get it. Using parse makes it explicit that p is a parser. Since applying a parser to a value always returns a value with a type that has the same relationship to the input value's type, using parse makes both the semantics and the type conversions explicit.

     

    Am I understanding this correctly?

    If not, I'd appreciate it if someone could expand upon Erik's statements.