[Haskell-cafe] Re: Math questions

Dan Doel dan.doel at gmail.com
Fri May 28 01:23:24 EDT 2010


On Thursday 27 May 2010 9:05:40 pm Ivan Miljenovic wrote:
> On 28 May 2010 09:37, Richard O'Keefe <ok at cs.otago.ac.nz> wrote:
> > On May 27, 2010, at 11:50 PM, Yitzchak Gale wrote:
> >> agree100 = (==) `on` for [1..100]
> > 
> > Search for "on" and "for" in the Haskell 98 Report and you
> > will not find them.  If you want to tell someone to use them,
> > you ought to tell them where to find them.
> 
> You mean like this?
> 
> http://haskell.org/hoogle/?hoogle=on
> http://haskell.org/hoogle/?hoogle=for

for from Data.Traversable cannot be what was intended, because it would 
require the functions to have type:

  a -> F b

for some Applicative F (which, moreover, should be providing the Eq instance 
you want to check with). This works for the identity functor (assuming the 
instance is declared), but the code is still not right, since the definition 
given doesn't lift the functions.

Rather:

  for = flip map

presumably. But this definition isn't in any of the standard libraries (at 
least visibly) to my knowledge.

-- Dan


More information about the Haskell-Cafe mailing list