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 Cheplyaka r

[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 = case

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Brandon Allbery
On Thu, Jul 11, 2013 at 1:33 PM, Vlatko Basic vlatko.ba...@gmail.comwrote: 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 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 Vlatko Basic
Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Brandon Allbery allber...@gmail.com To: Vlatko Bašić vlatko.ba...@gmail.com Cc: Haskell-Cafe haskell-cafe@haskell.org Date

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Roman Cheplyaka
* Vlatko Basic vlatko.ba...@gmail.com [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

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread David Thomas
On Thu, Jul 11, 2013 at 10:50 AM, Brandon Allbery allber...@gmail.comwrote: ... 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)

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Brandon Allbery
On Thu, Jul 11, 2013 at 2:11 PM, Vlatko Basic vlatko.ba...@gmail.comwrote: 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

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Vlatko Basic
Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Brandon Allbery allber...@gmail.com To: Vlatko Bašić vlatko.ba...@gmail.com Cc: Haskell-Cafe haskell-cafe@haskell.org Date

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Brandon Allbery
On Thu, Jul 11, 2013 at 2:58 PM, Vlatko Basic vlatko.ba...@gmail.comwrote: 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

Re: [Haskell-cafe] Comparing functions

2013-07-11 Thread Vlatko Basic
Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Brandon Allbery allber...@gmail.com To: Vlatko Bašić vlatko.ba...@gmail.com Cc: Haskell-Cafe haskell-cafe@haskell.org Date