Effective Haskell - Chapter 9 "Working with Monad Typeclass" and the Laws

In the List example for Chapter 9 “Working with Monad Typeclass”

  • Approx p 353 in ePub “Let’s write an Applicative instance for our List type next so we look at another example of writing a Monad” → Applicative instance should be Monad instance.
  • Approx p 354 in ePub “This works by defining a new type class, IsString, that we’ll create an instance of for our list.” We actually don’t define the typeclass. Either it should be defined or imported from Data.String.
  • Approx p 355 the first unwordsL $ pure "hello haskell" >>= wordsL >>= const Empty shouldn’t have the >>= const Empty since the comment says it’s demonstrating “we can call unwords to put them back into a string”

In “Using the Functor Laws” (approx p 358), the discussion of why the identity law doesn’t hold for the Outlaw, starts with running testComposition instead of testIdentity

In “Using The Monad Laws” (approx p 360), the Left Identity is return a >>= m = m s. But m s should be m a (it’s correct in the rewrite to compare with Functor identity).