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
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
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
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
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";
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
* 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
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
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 (==)) = "==
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 (==)) = "== "
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 =
11 matches
Mail list logo