Demystifying Function Sub-typing

location_city Bengaluru schedule Nov 16th 11:25 - 11:45 AM place Meeting Room 1 people 27 Interested

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)
 
 

Outline/Structure of the Talk

  • 5 mins
    1. Essential basics and an invented programming language for our discussion
    2. What is sub-typing
  • 8 mins
    1. Covariance & Contravariance
    2. Deriving the function sub-type
  • 7 mins
    1. Usage examples for function sub-types
    2. Implementation caveats in popular systems

Learning Outcome

Strong understanding of function sub-typing, useful in library design and contract modelling.

Target Audience

Anyone using FP, preferably strongly typed languages like Scala, Haskell etc.

Prerequisites for Attendees

Have a good understanding of FP concepts, especially First Class Functions and types.

schedule Submitted 1 year ago

Public Feedback


    • Liked Anupam Jain
      keyboard_arrow_down

      Anupam Jain - Typesafe Functional SQL

      45 Mins
      Talk
      Intermediate

      We'll discuss how to use strongly typed functional programming to build a typesafe and highly declarative DSL to generate SQL, that allows better abstractions and minimises runtime errors. We'll focus on type systems, and build an intuition for row types and how it guarantees correctness for SQL. I'll cover some parts of actual SQL generation.

      A similar talk was given at IIIT Delhi earlier, however that was more geared towards beginners to Functional Programming (link below). I plan to give a more intermediate level talk this time.

    • Liked Siddharth Bhat
      keyboard_arrow_down

      Siddharth Bhat - Monad-bayes: Probabilistic programming in haskell, tutorial & implementation

      Siddharth Bhat
      Siddharth Bhat
      Student
      IIIT Hyderabad
      schedule 11 months ago
      Sold Out!
      20 Mins
      Case Study
      Intermediate

      We take a dive into probabilistic programming, beginning with a high-level explanation of what probabilistic programming is. We then continue to see how to use the monad-bayes library for performing tasks such as regression in a bayesian formalism. We also look into the implementation of the library, which involves performing an interesting sampling method (markov-chain-monte-carlo) on a very unique space (the space of computational traces of the program). We finally end with next-steps for the haskell community to improve in the probablistic programming space, ala pyro for python

      Here is our tiny re-implementation of monad-bayes, boiled down to the essentials: https://github.com/bollu/shakuni

      Paper on which the talk is based on: http://mlg.eng.cam.ac.uk/pub/pdf/SciGhaGor15.pdf

    • Liked Ankit Jain
      keyboard_arrow_down

      Ankit Jain - Designing powerful real-time systems using Scala and Akka

      45 Mins
      Talk
      Intermediate

      Sky BML (Beat/Meet/Lose) is a streaming system that produces real time Competitive Intelligence about our Lodging Supply.

      This competitive information is being used, among others, for Market Managers to negotiate with hotels for better rates and avail. Competitiveness is proportional to the share of BML Losses that Expedia incurs. This is why Market Managers focus their energies on minimising losses.

      However, it is not easy to understand why losses occur and consequently their resolution takes proportionately long.Our system tries to simplify this and hence accelerate resolution of losses.

      To develop this system, we fully leveraged the power of different functional features of Scala and used Structured Spark Streaming as the processing engine in combination with Clustering(for better app supervision and lifecycle management of the nodes).

      Similarly, some of the complex challenges are solved very naturally using functional programming features of easily. We had this complex problem of traversing a decision tree (based on conditional expressions) and then evaluating the child nodes(which are also expressions) with different lookup services responsible for mapping the symbols used in Expressions.

      I will be discussing in detail on how we tactically use Functional Programming concepts like Implicits, currying, High-Order Functions to get rolling with this problem with ease.

      Similarly, I will discuss on the way we have apply OOP principles to handle different kinds of inputs(streaming/batch) with minimal code duplication.

      Overall, it will be lot of fun to discuss the way to think about our problems and how our thinking is shaped by different concepts available in Scala.

    • Liked Harmeet Singh
      keyboard_arrow_down

      Harmeet Singh - Type System: The Beauty And The Beast

      45 Mins
      Talk
      Intermediate

      The type system plays an important role in building type-safe applications that reduce runtime exceptions and developer mistakes. This sophisticated system is leveraged by Scala’s most famous functional libraries, such as Scala-Cats and ScalaZ. This feature-rich system allows implementing pure functional programming on the JVM. It is a beast due to its complex syntax, as it prevents developers from exploring its beautiful aspects like partially applying types in Scala. In this talk, we will tame the beast and use its beauty to solve real-life issues faced during coding. Our examples will be based on generics, constraints, type lambdas, and the kind projector plugin.

      The following are the learning objectives of this talk:

      1. Practical use cases of the type system using real-life coding.

      2. Implementing custom higher kinded types and handling partially applied types via type lambdas and the kind projector plugin.

    • Liked Siddharth Kulkarni
      keyboard_arrow_down

      Siddharth Kulkarni - Functional Programming in Rust Lang

      45 Mins
      Talk
      Beginner

      Rust is a new systems programming language that is garnering a lot attention from higher level programmers alike. It has a strong type system that enables some interesting functional programming patterns. Through this talk, I would like to demonstrate the Zero Cost Functional Abstractions in Systems Programming and Otherwise. The talk assumes intermediate level knowledge of FP principles and basic understanding of Rust Lang.

    • Liked ganesan arunachalam
      keyboard_arrow_down

      ganesan arunachalam - What the hell is monad? Why should you care?

      ganesan arunachalam
      ganesan arunachalam
      Developer
      ThoughtWorks
      schedule 11 months ago
      Sold Out!
      45 Mins
      Talk
      Intermediate

      Real world applications are hard to imagine without side effects such as writing to a DB or UI. IO-monads were introduced into the Haskell language to write programs in a robust way. And we have been using monads in our day to day job without even knowing those are monads such as IEnumerable/IObservable in languages like C#, Java.

      This talk is to give a basic understanding about monads and why should we care about that, and a little bit about onion/clean architecture.