← Back to Upcase

Reading group: Learn You a Haskell: Part Three

(Joe Ferris) #1

Next week, on Friday, February 28, we’ll cover the next two chapters:

  • Modules
  • Making Our Own Types and Typeclasses

I checked, and they’re roughly the same, whether you read the HTML or ebook version.

(Joe Ferris) #2

We didn’t get all the way through “Making Our Own Types and Typeclasses” this week, as that chapter was really dense. We covered:

  • Loading modules in ghci
  • Importing modules
  • Qualified import
  • Data.List
  • Data.Char
  • Data.Map
  • foldl’
  • Hoogle
  • Making modules
  • data (new types)
  • Value constructor functions
  • Exporting types
  • Record syntax
  • Type parameters
  • Type constructors
  • Derived instances
  • Show, Eq, Read, Ord
  • type (type aliases)
  • type class instances
  • Subclassing

We have an outstanding question: can you make your own typeclasses derivable? @pat and I are going to experiment and report back.

Next week, we’ll cover:

  • Functors, fmap, Maybe, and Either
  • Input/Output

(Joe Ferris) #3

Bad news on the deriving instances: you can’t make your own.

This is the best answer I’ve found: http://stackoverflow.com/questions/3864647/how-does-deriving-work-in-haskell

There’s some stuff in the works for this, but it’s experimental: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GenericDeriving