[Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]

Dan Doel dan.doel at gmail.com
Sat Jan 17 20:26:25 EST 2009

On Saturday 17 January 2009 8:28:05 am Bulat Ziganshin wrote:
> Hello Luke,
> Saturday, January 17, 2009, 3:16:06 PM, you wrote:
> >   fmap id = id
> >   fmap (f . g) = fmap f . fmap g
> >
> >  The first property is how we write "preserving underlying
> > structure", but this has a precise, well-defined meaning that we can
> > say a given functor obeys or it does not (and if it does not, we say
> > that it's a bad instance).  But you are correct that Haskell does
> > not allow us to require proofs of such properties.
> not haskell itself, but QuickCheck allows. we may even consider
> lifting these properties to the language level

QuickCheck doesn't allow you to prove that the properties hold, though. It can 
only prove that they don't hold, and consequently give you confidence that 
they do hold when the tests fail to prove that they don't.

To prove that they hold, you need something more like ESC/Haskell, catch or a 
fancier type system than the one Haskell (or even GHC) has.

-- Dan

More information about the Haskell-Cafe mailing list