Hi Konstantin,
Here is yet another possible approach:
Perhaps you really meant what you wrote in your definition
of firstFunction - namely, that it needs to be polymorphic,
so that it can convert to _any_ type that is an instance
of SecondClass.
In that case, you might want to add another
On Mon, 24 Dec 2007, Cristian Baboi wrote:
While reading the Haskell language report I noticed that function type is
not an instance of class Read.
I was told that one cannot define them as an instance of class Show
without breaking referential transparency or printing a constant.
f ::
Hello Konstantin,
Tuesday, December 25, 2007, 8:11:34 AM, you wrote:
class FirstClass a where
firstFunction :: (SecondClass b) = a - b
this looks like one more attempt to use OOP thinking in Haskell. look
at http://haskell.org/haskellwiki/OOP_vs_type_classes and especially
papers
On Mon, 2007-12-24 at 11:15 +0200, Cristian Baboi wrote:
While reading the Haskell language report I noticed that function type is
not an instance of class Read.
I was told that one cannot define them as an instance of class Show
without breaking referential transparency or printing a
On Tue, 25 Dec 2007 11:05:59 +0200, Derek Elkins
[EMAIL PROTECTED] wrote:
On Mon, 2007-12-24 at 11:15 +0200, Cristian Baboi wrote:
How can I define a function to do the inverse operation ?
g :: String - ( a - b )
This time I cannot see how referential transparency will deny it.
What's
Hi Cristian,
Cristian Baboi wrote:
While reading the Haskell language report I noticed that function type is
not an instance of class Read.
I was told that one cannot define them as an instance of class Show
without breaking referential transparency or printing a constant...
How can I define
I thought I understand monomorphism restriction. But it seems, I don't. I
have boilt down my problem to the following test. Don't try to make any
sense of it, it is just the smallest code I could come up with.
test :: (Integral a, RealFrac a) = a
test =
let c = undefined
in asTypeOf
As i understand it, the monomorphism restriction applies to constrained
type variables, but c :: forall a. a, so it remains polymorphic and each of
its uses can be instantiated to a different type.
2007/12/25, Henning Thielemann [EMAIL PROTECTED]:
I thought I understand monomorphism
Since it's possible to support laziness for Integer (while still
avoiding any stack overflow), I think it makes sense to do so. What
if you have some big complicated program like the following:
x = some big slow computation
y = [x..]
lots of code
z = length $ take 10 y
Why bother computing x
On Dec 25, 2007 4:27 PM, Henning Thielemann
[EMAIL PROTECTED] wrote:
test :: (Integral a, RealFrac a) = a
test =
let c = undefined
in asTypeOf (round c) c
When compiling I get:
Compiling StorableInstance ( src/StorableInstance.hs, interpreted )
src/StorableInstance.hs:38:17:
10 matches
Mail list logo