etworks
A: 17-29 Hawley Crescent London NW1 8TT | e:
nicholls.m...@vimn.com<mailto: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: [Haskel
You're running into the "open world"assumption--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.
Thi
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 wrote:
>
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 |
On Fri, 31 Dec 2010 12:32:06 +0100, Chionidis Ioannis
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 := (test mambo_orig)
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 t
On 1 July 2010 16:04, Christopher Tauss 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:
>
> Prelude> :
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 you
Great job Stephen.
Thank for explaining . I got it to work.
On Tue, Apr 20, 2010 at 9:21 AM, Stephen Tetley wrote:
> 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 gi
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, Fra
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 repl
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 accep
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
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 wrote:
>
> Hello
> I am sorry for the silly question.
>
> I have a function as t
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 ap
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 fie
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
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:
http://hackage.haskell.org/cgi-bin/h
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 terminate
FYI.
On Sat, 31 May 2008 02:11:13 +0200, "Daniel Fischer"
<[EMAIL PROTECTED]> said:
> Am Samstag, 31. Mai 2008 02:28 schrieb Martin 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
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 wh
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,
>>
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 cle
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.Excep
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
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 (
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 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 i
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.
http://haskell.org/haskellwiki/Moder
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
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 elab
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 th
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
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 abo
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
TECTED] 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
I'm not sure what you mean by "the strictness analyzer". GHC's strictness
analyzer?
I don't know, but I would hope so since it was done already in 1980 by Alan
Mycroft.
-- Lennart
On Sat, Feb 9, 2008 at 4:33 PM, Peter Verswyvelen <[EMAIL PROTECTED]> wrote:
> Consider the function
>
> cond x y
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
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.
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 choo
Hello Alexander,
Monday, January 21, 2008, 6:37:38 PM, you wrote:
> Hi, I try to undestand why this code dosen't work
> f :: (Num a)=>Integer->a
> f i = i
as for every beginner which tries to grok type classes, i recommend
you to read http://haskell.org/haskellwiki/OOP_vs_type_classes and
esp
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
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
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 lis
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 ad
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
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 ar
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 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 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 automat
(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 an
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?
On 12 Jan 2008, at 3:16 PM, 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, 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?)
>
> h
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
http://www.haskell.o
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 pa
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
___
Haske
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! :-)
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
Haskell-Cafe@has
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
>
> Ha
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)
>
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 write
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)
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)
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 structu
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 t
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, s
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
>
>
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 pa
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"
A
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 see
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
b
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
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 Practice\Haskell\GH
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 l
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
http://www
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. T
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 (Dat
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
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
> l
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 w
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 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 s
> foo n = if n<0 then [] else n : foo (n-1)
>
> bar n = aux 0 [] where
> aux i xs = if i>n 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
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
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. T
: [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 "th
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:
http://ha
> 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 th
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
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
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 instanc
ED] On Behalf Of Brian Hulley
Sent: Monday, August 06, 2007 9:15 PM
To: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Newbie question: "multi-methods" in Haskell
Dan Weston wrote:
> Remember that type classes do not provide object-oriented
> functionality. The dispatch is
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 solut
peterv schrieb:
In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
http://books.google.com/books?id=aJ1av7UFBPwC&pg=PA3&ots=YPiJ_nWi6Y&dq=moder
n+C%2B%2B&sig=FWO6SVfIrgtCWifj9yYHj3bnplQ#PPA263,M1
Chapter 11, Page 263 of this books:
The C++ virtual f
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
B
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, Aster
In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
http://books.google.com/books?id=aJ1av7UFBPwC&pg=PA3&ots=YPiJ_nWi6Y&dq=moder
n+C%2B%2B&sig=FWO6SVfIrgtCWifj9yYHj3bnplQ#PPA263,M1
How is this actually done in Haskell? Maybe this is just a basic feature
1 - 100 of 231 matches
Mail list logo