55: Dependent Types (Part 2) - JSToElm
All Episodes

55: Dependent Types (Part 2)

Types, types, types we are really trying to get our head around parametric types, and then take that the extra step to dependent types. Keeping in mind, that a type, is just a set of values, not some over whelming academic secret conspiracy to keep you in the dark. (that last part was directed at myself) Then we end up having an epiphany!!

Parametric Types

  • Defining type signatures with parameters that are themselves valid types.
  • Something like List Int would generally describe all lists in a given program that have items in that list that are integers

Dependent Types

  • If we take the idea of parametric types and stretch them a bit to behave more like functions, in the sense that they would take parameter values. Then you could have something like List 3 Int which would no longer represent any List that has Int values, but only List’s that have a length of 3 and are integers.

Picks

Resources

Follow

Published 25 Oct 2018

A show about learning Elm, Functional Programing, and generally leveling up as a JS developer.
JavaScript To Elm on Twitter