[Haskell-beginners] Re: Function composition with more than 1 parameter
daniel.is.fischer at web.de
Sat Oct 25 06:48:53 EDT 2008
Am Samstag, 25. Oktober 2008 12:34 schrieb Glurk:
> > The lambdabot on #haskell has a plugin named "pointless" that can
> > transform this into a definition that doesn't mention x and xs
> > anymore. I think it will propose
> > howMany = (length .) . matches
> > And with
> > matches x xs = filter (x==) xs
> > matches x = filter (x==)
> > matches = filter . (==)
> > we have
> > howMany = (length .) . filter . (==)
> > howMany = curry (length . uncurry matches)
> Thanks apfelmus,
> unfortunately, none of those suggested changes seem to work !
> I get errors like :-
> Unresolved top-level overloading
> *** Binding : howMany2
> *** Outstanding context : Eq b
> I'm using WinHugs - do you get them to work in some other environment ?
Did you give a type signature for these?
Then you would of course have to include the context Eq b, since (==) is used.
If you don't give any type signatures, all above versions should work in all
environments, otherwise it would be a serious bug.
> Thanks ! :)
More information about the Beginners