Anish will be presenting the following session
filter_list help_outline
  • Anish George
    keyboard_arrow_down

    Anish George - Demystifying Function Sub-typing

    Anish George
    Anish George
    UI Developer
    ThoughtWorks
    schedule 1 year ago
    Sold Out!
    20 Mins
    Talk
    Intermediate

    What is a Type for a function? When can you say that a function is a sub-type of another function? Why should you even bother?

    Function sub-typing is one of the most confusing areas of FP. In this talk, I'll take a deep dive and explain the core concepts of function types which applies to many different languages. More than just explaining the mere rules, I will be deriving those rules in a step-by-step fashion till the eureka moment so that you will never be confused again.

    The topics covered:

    1. Sub-typing basics
    2. Covariance & Contravariance
    3. Function sub-typing
    4. Implementation gotchas in different languages (Java, Scala, Haskell, JavaScript)
1. What got you into Functional Programming (FP)?

Came across a course on courser.org, "Programming Languages" by University of Washington. That was where I got introduced to functional programming as an alternative to Object Oriented style. They taught SML and Racket, but focused on the core concepts.

2. What has been your best moment or highlight working with FP?

When I started using FP patterns along with ReactJS to build out some nice Higher Order Components with minimal code.

3. What are some of the greatest challenges of working with FP?

I would say developer comfort of people you need to collaborate with. Since FP is not learnt by the vast majority early on, beautiful idioms and patterns like currying and partial application tends to trip other people up and becomes a maintainability issue.

4. All the mainstream programming languages are adding functional programming features. Most new languages and frameworks are strongly influenced by FP. What is your advice to object-oriented programmers?

Classes are an option in your toolbox. Not everything needs to be modelled that way. FP is another set of tools available to you, with its own set of pros and cons. Grab what tool you need according to the demands of the situation. FP is not hard, makes for beautiful code too.

5. What will be some of the key takeaways from your sessions at the conference?

That functions can also have (a sort of) type hierarchy which is often associated with classes, making them powerful abstractions in areas like library design.

6. The conference has more than 50 sessions. Which ones are you most looking forward to attending and why?

Saurabh Nanda - Why is Haskell so hard to learn? (and how to deal with it)... Because I have tried to learn Haskell and gave up after some time...  Want to understand how to cope up.

help