Re: [Haskell-cafe] Comparing functions

2013-07-12 Thread Vlatko Basic
Thanks Roman. Tried it and implemented, but had troubles until I realized that for String, 10 test take quite long. :-) However, I decided to solve this problem in a more "natural" way Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Roman

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Vlatko Basic
Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Brandon Allbery To: Vlatko Bašić Cc: Haskell-Cafe Date: 11.07.2013 21:03 On Thu, Jul

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Brandon Allbery
On Thu, Jul 11, 2013 at 2:58 PM, Vlatko Basic wrote: > Hm, I thought it is a pattern match with constant, as in f ('a':xs) == >> > > I wonder what you'd make of this definition, then? > > (*) `on` f = \x y -> f x * f y > > > According to the enlightenment above, I'd say (*) is a variable tha

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Vlatko Basic
Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Brandon Allbery To: Vlatko Bašić Cc: Haskell-Cafe Date: 11.07.2013 20:45 On Thu, Jul

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Brandon Allbery
On Thu, Jul 11, 2013 at 2:11 PM, Vlatko Basic wrote: > The problem here isn't quite what you think it is; (==) is not a > constructor, therefore it is a *variable*. It's exactly the same problem as > > a = 5 > -- ... > foo a = 3 -- this does NOT compare with the previous value of "a";

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread David Thomas
On Thu, Jul 11, 2013 at 10:50 AM, Brandon Allbery wrote: > > ... but functions don't have an Eq instance, and *can't* have one. > Not a general one that's interesting. There are two Eq instances that'll compile for all functions (not that it's advisable): instance Eq ((->) a b) where

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Roman Cheplyaka
* Vlatko Basic [2013-07-11 19:33:38+0200] > Hello Cafe, > > I have > > data CmpFunction a = CF (a -> a -> Bool) > > that contains comparing functions, like ==, <, > ..., and I'm trying > to declare the Show instance for it like this > > instance Show (CmpFunction a) where > show

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Vlatko Basic
Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Brandon Allbery To: Vlatko Bašić Cc: Haskell-Cafe Date: 11.07.2013 19:50 On Thu, Jul

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Timon Gehr
On 07/11/2013 07:33 PM, Vlatko Basic wrote: Hello Cafe, I have data CmpFunction a = CF (a -> a -> Bool) that contains comparing functions, like ==, <, > ..., and I'm trying to declare the Show instance for it like this instance Show (CmpFunction a) where show (CF (==)) = "==

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Brandon Allbery
On Thu, Jul 11, 2013 at 1:33 PM, Vlatko Basic wrote: > data CmpFunction a = CF (a -> a -> Bool) > > that contains comparing functions, like ==, <, > ..., and I'm trying to > declare the Show instance for it like this > > instance Show (CmpFunction a) where > show (CF (==)) = "== "

[Haskell-cafe] Comparing functions

2013-07-11 Thread Vlatko Basic
Hello Cafe, I have data CmpFunction a = CF (a -> a -> Bool) that contains comparing functions, like ==, <, > ..., and I'm trying to declare the Show instance for it like this instance Show (CmpFunction a) where show (CF (==)) = "== " -- no good show f =