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

Sign in to queue

More episodes in this series

Related episodes

The Discussion

  • User profile image

    I'm so loving these lectures!

    Thank you very much Charles and Erik for your work...you're doing a wonderful job!

    I'm really looking forward to see the last three (or maybe four Smiley) lectures

  • User profile image

    Excellent job Erik and C !! We would love very much for you guys to cover some advanced topics in Haskell and Fuctional Programming (as i mentioned in chapter 9 thread ) Thanks and continue with the excellent work.

  • User profile image

    Me too! Smiley


    Thank you.


    Erik deserves most of the credit here, of course - he's doing the lectures. Me, I just had the idea to do lectures on Channel 9. FP was the clear choice to launch this new content type on C9 because we have spent so much time talking about functional programming over the years that we felt it appropriate to just focus on FP in the most efficient way possible - experts lecturing, teaching.


    Keep on watching,



  • User profile image

    Still watching this episode, I just had to say I love how you tied "Theorems for free!" together with dependent typing as well as ADTs!

    In progress...

  • User profile image

    These lectures have been the highlight of my Thursdays. Smiley .  Thanks for taking the time to produce them. I’m looking forward to see this lecture tonight.

  • User profile image

    Today there is big snow in Calgary. I am enjoying the lecture on my Mac. Here is my type: snow a = Nothing | Big snow. Thank you Eric!

  • User profile image

    Erik: You are talking about "the expression problem" as still being a research subject. However, multimethods (as defined in the language Clojure) elegantly solves the problem?


  • User profile image
    A N Satrawala

    Eric, a very late question


    In object oriented languages, we have the flexibility of defining sub-classes late after super class has been defined. The two definitions need not be done simultaneously. Moreover, there is no limit on the number of sub-classes baring the case of sealed types (which could still be circumvented using containment and defining casts).

    In relation to the analogy of algebraic types and class hierarchies, what is the way in Haskell to extend the types as we can do in object oriented languages.

    For example:

    data Answer = No | Yes

    data AnswerEx = FromAnswer Answer | Unknown


    fromAnswerEx :: AnswerEx -> Answer

    fromAnswerEx FromAnswer a = a

    fromAnswerEx Unknown = No -- in Haskell we have to generate a value of Answer type here


    We could surely define functions for explicit conversion e.g. fromAnswerEx but the compiles can not use them automatically. In code given below we have to use the explicit conversions.


    answers = [Yes, No, fromAnswerEx Unknown, fromAnswerEx FromAnswer Yes]


    The following will not work.


    answers = [Yes, No, Unknown, FromAnswer Yes]


    It is possible there in object oriented languages.


    Is there any pattern/idiom in Haskell to achieve same?


Add Your 2 Cents