Hello,
I largely don't know what I'm doing or even trying to do, it is a voyage into
the unknownbutif I go...
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
class Foo x y | x -
The constraint on an instance never influences which instance is
selected. So as far as instance selection goes, 'instance Foo x' and
'instance C x = Foo x' are the same. The constraint is only checked
after the instance is selected.
Erik
On Fri, Jul 5, 2013 at 2:43 PM, Nicholls, Mark
You're running into the open worldassumption--anybody could come along
and make Integer part of your NotAnInteger class, and there's nothing you
can do to stop them. This is a design tradeoff for typeclasses: typeclass
instances are always global and are exported to all other modules you use.
This
London NW1 8TT | e:
nicholls.m...@vimn.commailto:m...@vimn.com T: +44 (0)203 580 2223
[Description: cid:image001.png@01CD488D.9204D030]
From: Tikhon Jelvis [mailto:tik...@jelv.is]
Sent: 05 July 2013 2:08 PM
To: Nicholls, Mark
Cc: haskell-cafe
Subject: Re: [Haskell-cafe] newbie question about
Hello everybody!
I am quite new to haskell programming. I am trying to make a gui for a
drumming project made in euterpea and I want to do something like this :
b - button f [text := Run! , on command := (test mambo_orig)]
test mambo_orig is executed from ghci but I want It to be able to
On Fri, 31 Dec 2010 12:32:06 +0100, Chionidis Ioannis
j...@echidna-band.com wrote:
Hello everybody!
I am quite new to haskell programming. I am trying to make a gui for a
drumming project made in euterpea and I want to do something like this :
b - button f [text := Run! , on command :=
Hello -
I just a day or so ago downloaded Hakell and am playing around with it, and
I came upon this problem with WinGHCi:
I am able to enter a multi-line do statement that works if I use brackets
and semi-colon like so:
Prelude :{
Prelude| let main2 = do {
Prelude| putStrLn Please enter your
On 1 July 2010 16:04, Christopher Tauss ctau...@gmail.com wrote:
Hello -
I just a day or so ago downloaded Hakell and am playing around with it, and
I came upon this problem with WinGHCi:
I am able to enter a multi-line do statement that works if I use brackets
and semi-colon like so:
Hi
If you are working with characteristic functions (Point - Bool or
Point - Colour...) the common way to do this is to manufacture a Num
instance for functions. This gives you syntax overloading of the (+,
-, *) operators. Similarly you might want to overload (or have to
overload) Floating,
Great job Stephen.
Thank for explaining . I got it to work.
On Tue, Apr 20, 2010 at 9:21 AM, Stephen Tetley stephen.tet...@gmail.comwrote:
Hi
If you are working with characteristic functions (Point - Bool or
Point - Colour...) the common way to do this is to manufacture a Num
instance for
Hello
I am sorry for the silly question.
I have a function as the following
func:: ((Float,Float) -Bool) - Float - ((Float,Float) - Bool)
I am trying to make calculation in this type ((Float,Float) -Bool) with
Float and then pass the information to ((Float,Float) - Bool)
Thank again
Can you at least give an example of how you intend to use this func?
Since you do not describe it's behaviour, it is very hard to make a useful
comment (at least for me)
Best,
On 19 April 2010 16:54, Mujtaba Boori mujtaba.bo...@gmail.com wrote:
Hello
I am sorry for the silly question.
I
sorry
ok I am trying to make these calculation
func (x,y) s dg =((x*(cos dg) - y*(sin dg)),(x*(sin dg) - y*(cos dg)))
This work for type (Float - Float)
but how can make it work with ((Float - Float) - Bool)
because my main function that I want use with. it takes (Float,Float)
-Bool) I
First of all, your function
func (x,y) s dg =((x*(cos dg) - y*(sin dg)),(x*(sin dg) - y*(cos dg)))
does NOT work for type (Float - Float), unless you mean that that is
the type of the unused parameter s. Also, your desired type ((Float -
Float) - Bool) itself looks suspicious. It must accept
Thanks Dan. Great help
but my problem has not solved yet
This doesn't work for type ((Float - Float)-Bool)
to make it easier ignore the rotation and suppose I want just multiplay with
whatever (x ,y) and return the result to this type ((Float - Float)-Bool)
note this type is shorten and replace
Hey everybody
I've been playing around with Parsec a little bit lately. I like it a
lot, but now I've hit a bit of a challenge. Suppose I have to parse a
variable length string representing a time interval. Depending on how
many fields there are, the time is either interpreted as seconds,
minutes
Am Montag 18 Januar 2010 19:09:23 schrieb david fries:
Hey everybody
I've been playing around with Parsec a little bit lately. I like it a
lot, but now I've hit a bit of a challenge. Suppose I have to parse a
variable length string representing a time interval. Depending on how
many fields
On 5/30/08, Martin Blais [EMAIL PROTECTED] wrote:
Dear Philip, could you point your virtual finger towards a
reference/paper/book/any-bleeping-thing that would help this simple
beginner understand why it doesn't work in this case? I'm trying to
picture why a read function that terminates the
Hi
The best thing to do is bypass read and use 'reads' to define your
own safe read.
maybeRead :: Read a = String - Maybe a
maybeRead s = case reads s of
[(x, )] - Just x
_ - Nothing
Or just use the Safe package:
Allright, this is a definitely a newbie question.
I'm learning Haskell and going through the exercises in the
beautiful Hutton book, and one of them requires for me to
write a loop that queries a line from the user (stdin),
looping until the user enters a valid integer (at least
that's how I want
On Fri, May 30, 2008 at 5:28 PM, Martin Blais [EMAIL PROTECTED] wrote:
Allright, this is a definitely a newbie question.
I'm learning Haskell and going through the exercises in the
beautiful Hutton book, and one of them requires for me to
write a loop that queries a line from the user
blais:
Allright, this is a definitely a newbie question.
I'm learning Haskell and going through the exercises in the
beautiful Hutton book, and one of them requires for me to
write a loop that queries a line from the user (stdin),
looping until the user enters a valid integer (at least
philip.weaver:
1. How do I catch the exception that is raised from read?
I think you want readIO, which yields a computation in the IO monad,
so it can be caught.
Ah, that's a third option, sequence the effect using readIO,
import System.IO
import qualified Control.Exception as C
On Fri, 30 May 2008 16:54:18 -0700, Philip Weaver
[EMAIL PROTECTED] said:
1. How do I catch the exception that is raised from read?
I think you want readIO, which yields a computation in the IO monad,
so it can be caught.
Holy schmoly, there it is, words of wisdom, written as clearly as can
On Fri, May 30, 2008 at 5:14 PM, Martin Blais [EMAIL PROTECTED] wrote:
On Fri, 30 May 2008 16:54:18 -0700, Philip Weaver
[EMAIL PROTECTED] said:
1. How do I catch the exception that is raised from read?
I think you want readIO, which yields a computation in the IO monad,
so it can be
On Fri, 30 May 2008 17:19:54 -0700, Philip Weaver
[EMAIL PROTECTED] said:
Dear Philip, could you point your virtual finger towards a
reference/paper/book/any-bleeping-thing that would help this simple
beginner understand why it doesn't work in this case? I'm trying to
picture why a read
On Thu, May 8, 2008 at 5:09 PM, Philip Müller [EMAIL PROTECTED] wrote:
Thanks for all the answers. I'm testing this right now and simples cases
work as expected. However from what I've read it seems it'll get ugly once I
try to pass a C array to a Haskell function.
Well, maybe arrays in C
Hi,
I'm in the process of writing a C program, but I can't stop thinking
about how some functions would be much nicer implemented in Haskell.
Is there a way to write some of the functions in Haskell and then use
them in my C code via some kind of interface?
BTW yes, I have been thinking
Hello Philip,
Friday, May 9, 2008, 2:17:41 AM, you wrote:
Is there a way to write some of the functions in Haskell and then use
them in my C code via some kind of interface?
http://haskell.org/haskellwiki/IO_inside#Interfacing_with_foreign_evil_.28under_development.29
and then entries 1,6,7
mail:
Is there a way to write some of the functions in Haskell and then use
them in my C code via some kind of interface?
Using C just for IO is a bit weird -- perhaps you could illustrate
the kind of IO you're doing? Learning how to do IO in Haskell is
a much safer solution that linking the
Thanks for all the answers. I'm testing this right now and simples cases
work as expected. However from what I've read it seems it'll get ugly
once I try to pass a C array to a Haskell function.
Well, maybe arrays in C have been ugly before trying to pass them to
Haskell functions ;)
To
mail:
Thanks for all the answers. I'm testing this right now and simples
cases work as expected. However from what I've read it seems it'll
get ugly once I try to pass a C array to a Haskell function.
Right, passing arrays back and forth is going to get tiring.
Well, maybe arrays in C
Hello Philip,
Friday, May 9, 2008, 3:09:33 AM, you wrote:
Thanks for all the answers. I'm testing this right now and simples cases
work as expected. However from what I've read it seems it'll get ugly
once I try to pass a C array to a Haskell function.
] On
Behalf Of Lennart Augustsson
Sent: maandag 11 februari 2008 0:28
To: Peter Verswyvelen
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Newbie question: mutually exclusive strict /
lazy
I'm not sure what you mean by the strictness analyzer. GHC's strictness
analyzer?
I don't know, but I
2008/2/11, Peter Verswyvelen [EMAIL PROTECTED]:
Yes, sorry, GHC's strictness analyzer.
What I meant with this email is that I guess that for a strictness analyzer,
the information that a function is strict in an argument *independent from
the other arguments* would not be good enough in
Consider the function
cond x y z = if x then y else z
I guess we can certainly say cond is strict in x.
But what about y and z?
If x is true, then cond is strict in y
If x is false, then cond is strict in z
So we can't really say cond is lazy nor strict in its second or third argument.
Am Samstag, 9. Februar 2008 17:33 schrieb Peter Verswyvelen:
Consider the function
cond x y z = if x then y else z
I guess we can certainly say cond is strict in x.
But what about y and z?
If x is true, then cond is strict in y
If x is false, then cond is strict in z
So we can't
Hi, I try to undestand why this code dosen't work
f :: (Num a)=Integer-a
f i = i
Integer is an instance of Num, so why does this code produce error:
Couldn't match expected type 'a' againsta inferred type 'Integer' ...
___
Haskell-Cafe mailing list
2008/1/21 Alexander Seliverstov [EMAIL PROTECTED]:
Hi, I try to undestand why this code dosen't work
f :: (Num a)=Integer-a
f i = i
Integer is an instance of Num, so why does this code produce error:
Couldn't match expected type 'a' againsta inferred type 'Integer' ...
But the type of
How does caller choose which particular instance of Num they want?
In object-oriented language If function return type is an interface it means
that it can return any implementation of this interface, but caller can't
choose which particular inplementation they want.
What the difference between
Hello Alexander,
Monday, January 21, 2008, 7:36:18 PM, you wrote:
How does caller choose which particular instance of Num they want?
In object-oriented language If function return type is an interface
it means that it can return any implementation of this interface,
but caller can't choose
Henning Thielemann writes:
Caching is not the default, but you can easily code this by yourself:
Define an array and initialize it with all function values. Because of
lazy evaluation the function values are computed only when they are
requested and then they persist in the array.
One should
On 12 Jan 2008, at 23:16, Hugh Perkins wrote:
On Jan 12, 2008 10:54 PM, Henning Thielemann
[EMAIL PROTECTED] wrote:
On Sat, 12 Jan 2008, Hugh Perkins wrote:
I guess that Haskell's referential transparence means the answers to
the isPerfectSquare will be cached, ie automatically memoized?
(While writing this message GMail told me I was too late to answer the
question. Oh well, as I already typed it, let's send =)
On Jan 12, 2008 9:16 PM, Hugh Perkins [EMAIL PROTECTED] wrote:
Interesting... but I dont understand... I thought that referential
transparence meant that once the
On Sun, 13 Jan 2008, Hugh Perkins wrote:
On Jan 12, 2008 10:54 PM, Henning Thielemann
[EMAIL PROTECTED] wrote:
On Sat, 12 Jan 2008, Hugh Perkins wrote:
I guess that Haskell's referential transparence means the answers to
the isPerfectSquare will be cached, ie automatically
On Jan 12, 2008, at 18:16 , Hugh Perkins wrote:
On Jan 12, 2008 10:54 PM, Henning Thielemann
[EMAIL PROTECTED] wrote:
On Sat, 12 Jan 2008, Hugh Perkins wrote:
I guess that Haskell's referential transparence means the answers to
the isPerfectSquare will be cached, ie automatically memoized?
On Jan 12, 2008 10:54 PM, Henning Thielemann
[EMAIL PROTECTED] wrote:
On Sat, 12 Jan 2008, Hugh Perkins wrote:
I guess that Haskell's referential transparence means the answers to
the isPerfectSquare will be cached, ie automatically memoized? (not
sure if is correct term?)
On 1/12/08, Henning Thielemann [EMAIL PROTECTED] wrote:
Caching is not the default, but you can easily code this by yourself:
Define an array and initialize it with all function values. Because of
lazy evaluation the function values are computed only when they are
requested and then they
On 12 Jan 2008, at 3:30 PM, David Benbennick wrote:
On 1/12/08, Henning Thielemann [EMAIL PROTECTED] wrote:
Caching is not the default, but you can easily code this by
yourself:
Define an array and initialize it with all function values.
Because of
lazy evaluation the function values are
On Sat, 12 Jan 2008, David Benbennick wrote:
On 1/12/08, Henning Thielemann [EMAIL PROTECTED] wrote:
Caching is not the default, but you can easily code this by yourself:
Define an array and initialize it with all function values. Because of
lazy evaluation the function values are
On Jan 12, 2008 11:30 PM, David Benbennick [EMAIL PROTECTED] wrote:
On 1/12/08, Henning Thielemann [EMAIL PROTECTED] wrote:
Caching is not the default, but you can easily code this by yourself:
Define an array and initialize it with all function values. Because of
lazy evaluation the
Hi,
I have this function that sums up a list of numbers:
suma [] = 0
suma (h:t) = h + suma t
However, why do I need the parenthes in the second clause? What does the
compiler think I'm trying to do when I type
suma [] = 0
suma h:t = h + suma t
Thanks! :-)
Hi
suma [] = 0
suma (h:t) = h + suma t
suma [] = 0
suma h:t = h + suma t
Infix operators bind less tightly than function application, so the
compiler sees:
(suma h) : t = h + (suma t)
Hence the compiler gets confused.
Thanks
Neil
___
Fernando Rodriguez wrote:
Hi,
I have this function that sums up a list of numbers:
suma [] = 0
suma (h:t) = h + suma t
However, why do I need the parenthes in the second clause? What does the
compiler think I'm trying to do when I type
suma [] = 0
suma h:t = h + suma t
Definitions are
However, why do I need the parenthes in the second clause? What
does the compiler think I'm trying to do when I type
suma [] = 0
suma h:t = h + suma t
(suma h):t = h + suma t
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Hi,
I am new to functional and lazy programming languages ( that's correct, my
life has been pretty pathetic so far) and am not able to understand GHC's
behaviour for a particular function. Can someone help me please?
I am trying to write a function which would compare two strings (from
reverse)
You have used the name 'pos' twice, for both the parameter and the
returned value of the recursive call. The reason this results in an
infinite loop is that in code like
let x = x + 1
Haskell treats both xs to be references to the same thing, so evaluates:
x
= x + 1
= (x + 1) + 1
= ((x + 1) + 1)
On 6 Jan 2008, at 10:34 AM, Sai Hemanth K wrote:
Hi,
I am new to functional and lazy programming languages ( that's
correct, my life has been pretty pathetic so far) and am not able
to understand GHC's behaviour for a particular function. Can
someone help me please?
I am trying to
On Jan 6, 2008 4:40 PM, Jonathan Cast [EMAIL PROTECTED] wrote:
let is always recursive in Haskell, so this is a recursive definition
of pos. To break the recursion, use
matchReverse (x:xs) (y:ys) pos = let (matched, pos') = matchReverse
xs ys (pos + 1)
in
AAh! Thanks a ton!
Hemanth K
On Jan 7, 2008 12:10 AM, Rodrigo Queiro [EMAIL PROTECTED] wrote:
You have used the name 'pos' twice, for both the parameter and the
returned value of the recursive call. The reason this results in an
infinite loop is that in code like
let x = x + 1
Haskell
Felipe Lessa wrote:
As as side note, GHC's flag -Wall would have warned about creating a
variable with a name already in scope.
*makes a mental note*
I've created bugs like this far too many times...
___
Haskell-Cafe mailing list
Brian Hurt [EMAIL PROTECTED] wrote:
But I was wondering if it is possible that lazy evaluation
could lead to space compression, especially under heavily persistant
usage patterns?
Note that the benefit isn't *big*- we're talking about 40 words of
memory when the main data structure is
My apologies if this has been beat to death before, I'm still new to
Haskell. But I was wondering if it is possible that lazy evaluation could
lead to space compression, especially under heavily persistant usage
patterns?
Here's the argument I'm making. Say we have a tree-based Set with,
Am Samstag, 29. Dezember 2007 16:00 schrieb Brian Hurt:
My apologies if this has been beat to death before, I'm still new to
Haskell. But I was wondering if it is possible that lazy evaluation could
lead to space compression, especially under heavily persistant usage
patterns?
Here's the
John Lato wrote:
I'm working
with moderate-sized files (tens to hundreds of MBs) that have some
ascii header data followed by a bunch of 32-bit ints.
but I don't know if [Int32] is actually the best choice. It seems to me
that something like a lazy list of strict arrays (analogous to a lazy
One factor that is slightly unusual about this
phenomenon is that it only occurs with GHC, but not
with Hugs 98. Typing
:cd D:\From C Drive\Documents and
Settings\DekuDekuplex\Programming
Practice\Haskell\GHC
in Hugs 98 does not cause an error, but typing the
same command in GHC does. It
On Mon, Oct 29, 2007 at 04:25:45AM -0700, Benjamin L. Russell wrote:
One factor that is slightly unusual about this
phenomenon is that it only occurs with GHC, but not
with Hugs 98. Typing
:cd D:\From C Drive\Documents and
Settings\DekuDekuplex\Programming
Practice\Haskell\GHC
Are you
In GHC it works without the and don't work with them:
Prelude :cd C:\Documents and Settings
Prelude :! pwd
C:\Documents and Settings
Olivier.
On 10/29/07, Benjamin L. Russell [EMAIL PROTECTED] wrote:
Please pardon this intrusion for an elementary
question on setting the GHC search path.
I
You're right; it works without the double-quotes.
Problem solved. Thanks!
Benjamin L. Russell
--- Olivier Boudry [EMAIL PROTECTED] wrote:
In GHC it works without the and don't work with
them:
Prelude :cd C:\Documents and Settings
Prelude :! pwd
C:\Documents and Settings
Olivier.
Hello,
I've been following the list optimization thread with great interest,
as it pertains to something I'm working on at the moment. I'm working
with moderate-sized files (tens to hundreds of MBs) that have some
ascii header data followed by a bunch of 32-bit ints. I can read the
files into a
Please pardon this intrusion for an elementary
question on setting the GHC search path.
I have installed GHC on my work Windows XP machine,
and would like to be able to search for files in the
following directory:
D:\From C Drive\Documents and
Settings\DekuDekuplex\Programming
jwlato:
Hello,
I've been following the list optimization thread with great interest,
as it pertains to something I'm working on at the moment. I'm working
with moderate-sized files (tens to hundreds of MBs) that have some
ascii header data followed by a bunch of 32-bit ints. I can read the
Hi!
I am a novice in Haskell, and particularly I have interested in generic
programming. This interest motivated me to read paper Scrap your
boilerplate: A practical design pattern for generic programming, but I
didn't understand the type of the function gfoldl, that was present in class
Term
Just so nobody else has to look it up:
Data.Generics.Basics.gfoldl :: Data a = (c (a - b) - a - c b) - (g - c
g) - a - c a
-- ryan
On 8/30/07, Rodrigo Geraldo [EMAIL PROTECTED] wrote:
Hi!
I am a novice in Haskell, and particularly I have interested in generic
programming. This interest
Actually, it's a higher rank type and that doesn't show up on hoogle's main
page.
gfoldl :: (forall a b . Data a = c (a - b) - a - c b)
- (forall g . g - c g)
- a
- c a
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On 8/20/07, Stefan O'Rear [EMAIL PROTECTED] wrote:
...
(I need to find some way to automate making these trails :) )
...
I think you can come a long way with the debugger in GHC HEAD. It
provides a :trace command that, when applied to an expression with
some breakpoint in it, remembers the
Stefan O'Rear wrote:
sum = sum' 0
sum' k [] = k
sum' k (x:xs) = (sum' $! (k+x)) xs
enum x y | x = y= 0
| otherwise = x : enum (x+1) y
sum (enum 1 10) =
sum' 0 (enum 1 10) =
sum' 0 (1 : enum (1+1) 10) =
(sum' $! (0+1)) (enum (1+1) 10) =
sum' 1
Not really more efficient but plays to the language
implementation's strengths.
Imagine
take 10 $ foo (10^9)
and
take 10 $ bar (10^9)
bar wouldn't evaluate until the 10^9 was done. (And I just
ground my laptop to a halt checking that. :) foo on the other
hand would run out to 10^6
Lanny Ripple wrote:
Not really more efficient but plays to the language implementation's
strengths.
Imagine
take 10 $ foo (10^9)
and
take 10 $ bar (10^9)
bar wouldn't evaluate until the 10^9 was done. (And I just ground my
laptop to a halt checking that. :) foo on the other hand
On Mon, Aug 20, 2007 at 11:21:01AM -0500, Lanny Ripple wrote:
Not really more efficient but plays to the language implementation's
strengths.
Imagine
take 10 $ foo (10^9)
and
take 10 $ bar (10^9)
bar wouldn't evaluate until the 10^9 was done. (And I just ground my
laptop to a
: [Haskell-cafe] Newbie question: Where is StackOverflow on the
Wiki?
On Sat, 2007-08-18 at 20:35 +0200, Peter Verswyvelen wrote:
When reading an article about tail recursion
(http://themechanicalbride.blogspot.com/2007/04/haskell-for-c-3-programmers.
html) I came across the follow statements
When reading an article about tail recursion
(http://themechanicalbride.blogspot.com/2007/04/haskell-for-c-3-programmers.
html) I came across the follow statements:
If you can write a non-recursive function that uses the colon syntax it is
probably better than a tail recursive one that doesn't.
On Sat, 2007-08-18 at 20:35 +0200, Peter Verswyvelen wrote:
When reading an article about tail recursion
(http://themechanicalbride.blogspot.com/2007/04/haskell-for-c-3-programmers.
html) I came across the follow statements:
If you can write a non-recursive function that uses the colon
foo n = if n0 then [] else n : foo (n-1)
bar n = aux 0 [] where
aux i xs = if in then xs else aux (i+1) (i:xs)
that foo is more efficient than bar because lazy evaluation of foo just puts
the delayed computation in the cdr of the list, while lazy evaluation of
bar has to keep track of
I’m having difficulty to understand what phantom types are good for. Is this
just for improving runtime performance?
I read the wiki, and it says this is useful if you want to increase the
type-safety of your code, but the code below does not give a compiler error
for the function test1, I get a
peterv wrote:
I’m having difficulty to understand what phantom types are good for.
I read the wiki, and it says this is useful if you want to increase the
type-safety of your code, but the code below does not give a compiler error
for the function test1, I get a runtime error, just like test2.
Im having difficulty to understand what phantom types are good for. Is
this just for improving runtime performance?
No. As the wiki says, you can use them to add static guarantees.
I read the wiki, and it says this is useful if you want to increase the
type-safety of your code, but the
On Aug 8, 2007, at 11:16 AM, peterv wrote:
I’m having difficulty to understand what phantom types are good
for. Is this
just for improving runtime performance?
I found phantom types to be useful in the implementation of bit-wise
set operations. You can find the code Edison:
: [Haskell-cafe] Newbie question (again!) about phantom types
I'm having difficulty to understand what phantom types are good for. Is
this just for improving runtime performance?
No. As the wiki says, you can use them to add static guarantees.
I read the wiki, and it says this is useful if you want
In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
http://books.google.com/books?id=aJ1av7UFBPwCpg=PA3ots=YPiJ_nWi6Ydq=moder
n+C%2B%2Bsig=FWO6SVfIrgtCWifj9yYHj3bnplQ#PPA263,M1
How is this actually done in Haskell? Maybe this is just a basic feature of
peterv wrote:
In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
Using multi-methods, I could write (in pseudo code)
collide (Asteroid, Planet) = an asteroid hit a planet
collide (Asteroid, Earth) = the end of the dinos
...
collide (Planet,
Remember that type classes do not provide object-oriented functionality.
The dispatch is static, not dynamic. Although OOP can be simulated in
Haskell, it is not a natural idiom. If you need dynamic dispatch
(including multiple dispatch), you may want to reconsider your solution.
Dan Weston
peterv schrieb:
In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
http://books.google.com/books?id=aJ1av7UFBPwCpg=PA3ots=YPiJ_nWi6Ydq=moder
n+C%2B%2Bsig=FWO6SVfIrgtCWifj9yYHj3bnplQ#PPA263,M1
Chapter 11, Page 263 of this books:
The C++ virtual
Dan Weston wrote:
Remember that type classes do not provide object-oriented
functionality. The dispatch is static, not dynamic. Although OOP can
be simulated in Haskell, it is not a natural idiom. If you need
dynamic dispatch (including multiple dispatch), you may want to
reconsider your
(Asteroid, Jupiter)
-- However, this one gives an error?
--aa = collide (Asteroid, Asteroid)
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Hulley
Sent: Monday, August 06, 2007 9:15 PM
To: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Newbie
peterv wrote:
This is very nice, but it does not really solve the original problem.
To get Haskell to choose the best fit it's necessary to encode the
location of each element in the hierarchy, so that elements deeper in
the hierarchy are more instantiated than those at the top. Then
Bryan Burgers wrote:
On 7/30/07, peterv [EMAIL PROTECTED] wrote:
Does Haskell support any form of automatic memorization?
For example, does the function
iterate f x
which expands to
[x, f(x), f(f(x)), f(f(f(x))), …
gets slower and slower each iteration, or can it take
Having only a couple of days of practice programming Haskell (but having
read lots of books and docs), I find myself writing very explicit low level
code using inner aux functions (accumulators and loops). Then I force
myself to revise the code, replacing these aux functions with suitable
Thanks! Is this is also the case when using let and where, or is this just
syntactic sugar?
-Original Message-
From: Jules Bean [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 31, 2007 5:09 PM
To: Bryan Burgers
Cc: peterv; haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Newbie
On 31/07/07, peterv [EMAIL PROTECTED] wrote:
Having only a couple of days of practice programming Haskell (but having
read lots of books and docs), I find myself writing very explicit low level
code using inner aux functions (accumulators and loops). Then I force
myself to revise the
1 - 100 of 209 matches
Mail list logo