Hello Deniz,
Wednesday, October 7, 2009, 5:23:24 PM, you wrote:
>> Possible cause: the monomorphism restriction applied to the following:
>> ord :: a -> Int (bound at test.hs:1:0)
>> Probable fix: give these definition(s) an explicit type signature
>> or use -fno-monom
2009/10/7 Bulat Ziganshin :
> Hello Deniz,
>
> Wednesday, October 7, 2009, 5:03:59 PM, you wrote:
>
> it depends. what i see with ghc 6.6.1:
>
> [snip]
>
> Possible cause: the monomorphism restriction applied to the following:
> ord :: a -> Int (bound at test.hs:1:0)
> Probable fix: give
Hello Deniz,
Wednesday, October 7, 2009, 5:03:59 PM, you wrote:
it depends. what i see with ghc 6.6.1:
C:\!\Haskell>runghc test.hs
test.hs:1:6:
Ambiguous type variable `a' in the constraint:
`Enum a' arising from use of `fromEnum' at test.hs:1:6-13
Possible cause: the monomorphism
2009/10/7 michael rice
>
> Actually I used it to fake the Pascal ord(x) function:
>
> ord = fromEnum
>
> Problem?
>
> Michael
>
If the monomorphism restriction applies, the compiler (assuming you're
using GHC) will tell you about it.
--
Deniz Dogan
___
Actually I used it to fake the Pascal ord(x) function:
ord = fromEnum
Problem?
Michael
--- On Wed, 10/7/09, Bulat Ziganshin wrote:
From: Bulat Ziganshin
Subject: Re[4]: [Haskell-cafe] Creating an alias for a function
To: "Luke Palmer"
Cc: "Bulat Ziganshin" , haskell-c
Hello Luke,
Wednesday, October 7, 2009, 11:35:47 AM, you wrote:
>>> car = head
>>
>> unfortunately it doesn't work without -fno-monomorphism-restriction
> It should be fine without the monomorphism restriction. Said
> restriction only applies to functions with typeclass constraints, of
> which
On Wed, Oct 7, 2009 at 1:26 AM, Bulat Ziganshin
wrote:
> Hello Ross,
>
> Wednesday, October 7, 2009, 6:02:28 AM, you wrote:
>
>> car = head
>
> unfortunately it doesn't work without -fno-monomorphism-restriction
It should be fine without the monomorphism restriction. Said
restriction only applie
Hello Ross,
Wednesday, October 7, 2009, 6:02:28 AM, you wrote:
> car = head
unfortunately it doesn't work without -fno-monomorphism-restriction
--
Best regards,
Bulatmailto:bulat.zigans...@gmail.com
___
Haskell-Cafe mai
Thanks all!
There's ALWAYS seems to be a neat way to do what's needed with Haskell.
Michael
--- On Tue, 10/6/09, Joe Fredette wrote:
From: Joe Fredette
Subject: Re: [Haskell-cafe] Creating an alias for a function
To: "michael rice"
Cc: haskell-cafe@haskell.org
Date: Tues
Michael,
You can define a function without listing some or all of its arguments
by specifying it in terms of another function. So all you really need
to write is, e.g.,
car = head
cdr = tail
cadr = car . cdr
caddr = car . cadr
cadar = car . cdr . car
etc...
On Oct 6, 2009, at 7:01 PM, mi
Well, you can drop the arguments entirely, and let the type be
inferred to get
car = head
which is pretty nice. You could use an INLINE hint to make the
compiler replace it before compilation, though I don't think it would
change performance much...
/Joe
On Oct 6, 2009, at 10:01 PM,
car = head
letting the compiler infer the type, or
car :: [a] -> a
car = head
for the explicit version.
-Ross
On Oct 6, 2009, at 10:01 PM, michael rice wrote:
How do I create an alias for a function, like giving CAR the same
functionality as HEAD. I know I can do it by creating a definitio
Hallo,
On Tue, Oct 6, 2009 at 11:01 PM, michael rice wrote:
>
> How do I create an alias for a function, like giving CAR the same
> functionality as HEAD. I know I can do it by creating a definition (see
> below), but is there a better way, like Scheme's
>
> (define head car)
>
> car :: [a] ->
How do I create an alias for a function, like giving CAR the same functionality
as HEAD. I know I can do it by creating a definition (see below), but is there
a better way, like Scheme's
(define head car)
car :: [a] -> a
car x = head x
The reason for doing this is to more closely mirror legac
14 matches
Mail list logo