[Haskell-cafe] Pattern matching does not work like this?

Felipe Lessa felipe.lessa at gmail.com
Wed Jul 15 08:32:14 EDT 2009


On Wed, Jul 15, 2009 at 08:09:37AM -0400, Andrew Wagner wrote:
> Err, technically, aren't functions and constructors mutually exclusive? So
> if something is a function, it's, by definition, not a constructor?

I guess what Eugene Kirpichov meant was that not being a function
(and being a constructor) isn't sufficient, it must also be a
constructor of the correct type, e.g.

  f Nothing = ...
  f (x:xs)  = ...

isn't correct, however it pattern matches on constructors only.

--
Felipe.


More information about the Haskell-Cafe mailing list