Skip to main content

Home/ Haskell/ Group items tagged laws

Rss Feed Group items tagged

Javier Neira

Learning Haskell Notes - 0 views

  • 8. Functors
  • A "functor" is a structured collection (or container) type with a method (fmap) that accepts a method and applies that method to the members of the collection yielding an isomorphic collection of values of a (possibly) new type. Is this right?
  • Every monad is a functor, but not the other way around; a monad is a functor PLUS functions >>= and return satisfying some laws
  • ...4 more annotations...
  • a functor is a type constructor PLUS a function fmap satisfying some laws.
  • I think it's better to use existentials, as they let you define multiple instances for the same type.
  • People tend to forget that the major difference between ADT's and OO-style classes is really only that with a class you can have many instances in the same program simultaneously, whereas with an ADT you can have only one; but the ADT implementation is still interchangeable.
  • sequence :: Monad m => [m a] -> m [a]
1 - 2 of 2
Showing 20 items per page