[Haskell-cafe] newbie question about Functional dependencies conflict between instance declarations:.....

2013-07-05 Thread Nicholls, Mark
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 -

Re: [Haskell-cafe] newbie question about Functional dependencies conflict between instance declarations:.....

2013-07-05 Thread Erik Hesselink
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

Re: [Haskell-cafe] newbie question about Functional dependencies conflict between instance declarations:.....

2013-07-05 Thread Tikhon Jelvis
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

Re: [Haskell-cafe] newbie question about Functional dependencies conflict between instance declarations:.....

2013-07-05 Thread Nicholls, Mark
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

[Haskell-cafe] Newbie Question

2010-12-31 Thread Chionidis Ioannis
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

Re: [Haskell-cafe] Newbie Question

2010-12-31 Thread Henk-Jan van Tuyl
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 :=

[Haskell-cafe] Newbie question about using WinGHCi

2010-07-01 Thread Christopher Tauss
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

Re: [Haskell-cafe] Newbie question about using WinGHCi

2010-07-01 Thread Ivan Miljenovic
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:

Re: [Haskell-cafe] newbie question how to pass data

2010-04-20 Thread Stephen Tetley
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,

Re: [Haskell-cafe] newbie question how to pass data

2010-04-20 Thread Mujtaba Boori
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

[Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Mujtaba Boori
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

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Ozgur Akgun
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

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Mujtaba Boori
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

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Dan Weston
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

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Mujtaba Boori
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

[Haskell-cafe] Newbie question about Parsec

2010-01-18 Thread 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 there are, the time is either interpreted as seconds, minutes

Re: [Haskell-cafe] Newbie question about Parsec

2010-01-18 Thread Daniel Fischer
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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-06-02 Thread Ryan Ingram
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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-06-02 Thread Neil Mitchell
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:

[Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread 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 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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Philip Weaver
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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Don Stewart
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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Don Stewart
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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Martin Blais
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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Philip Weaver
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

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Martin Blais
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

Re: [Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-11 Thread Luke Palmer
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

[Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-08 Thread Philip Müller
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

Re: [Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-08 Thread Bulat Ziganshin
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

Re: [Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-08 Thread Don Stewart
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

Re: [Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-08 Thread Philip Müller
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

Re: [Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-08 Thread Don Stewart
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

Re[2]: [Haskell-cafe] Newbie Question: Using Haskell Functions in a C Program

2008-05-08 Thread Bulat Ziganshin
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.

RE: [Haskell-cafe] Newbie question: mutually exclusive strict / lazy

2008-02-11 Thread Peter Verswyvelen
] 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

Re: [Haskell-cafe] Newbie question: mutually exclusive strict / lazy

2008-02-11 Thread Loup Vaillant
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

[Haskell-cafe] Newbie question: mutually exclusive strict / lazy

2008-02-09 Thread 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 really say cond is lazy nor strict in its second or third argument.

Re: [Haskell-cafe] Newbie question: mutually exclusive strict / lazy

2008-02-09 Thread Daniel Fischer
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

[Haskell-cafe] Newbie question

2008-01-21 Thread Alexander Seliverstov
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

Re: [Haskell-cafe] Newbie question

2008-01-21 Thread Brent Yorgey
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

Re: [Haskell-cafe] Newbie question

2008-01-21 Thread Alexander Seliverstov
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

Re[2]: [Haskell-cafe] Newbie question

2008-01-21 Thread Bulat Ziganshin
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

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-13 Thread jerzy . karczmarczuk
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

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Thomas Davie
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?

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Felipe Lessa
(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

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Henning Thielemann
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

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Brandon S. Allbery KF8NH
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?

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Hugh Perkins
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?)

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread David Benbennick
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

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Jonathan Cast
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

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Henning Thielemann
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

Re: [Haskell-cafe] [newbie question] Memoization automatic in Haskell?

2008-01-12 Thread Luke Palmer
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

[Haskell-cafe] Newbie question: the need for parentheses

2008-01-08 Thread Fernando Rodriguez
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! :-)

Re: [Haskell-cafe] Newbie question: the need for parentheses

2008-01-08 Thread Neil Mitchell
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 ___

Re: [Haskell-cafe] Newbie question: the need for parentheses

2008-01-08 Thread Jules Bean
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

Re: [Haskell-cafe] Newbie question: the need for parentheses

2008-01-08 Thread Miguel Mitrofanov
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

[Haskell-cafe] Newbie question related to list evaluation

2008-01-06 Thread Sai Hemanth K
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)

Re: [Haskell-cafe] Newbie question related to list evaluation

2008-01-06 Thread Rodrigo Queiro
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)

Re: [Haskell-cafe] Newbie question related to list evaluation

2008-01-06 Thread Jonathan Cast
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

Re: [Haskell-cafe] Newbie question related to list evaluation

2008-01-06 Thread Felipe Lessa
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

Re: [Haskell-cafe] Newbie question related to list evaluation

2008-01-06 Thread Sai Hemanth K
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

Re: [Haskell-cafe] Newbie question related to list evaluation

2008-01-06 Thread Andrew Coppin
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

Re: [Haskell-cafe] Newbie question: can laziness lead to space compression?

2008-01-02 Thread Malcolm Wallace
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

[Haskell-cafe] Newbie question: can laziness lead to space compression?

2007-12-29 Thread 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 argument I'm making. Say we have a tree-based Set with,

Re: [Haskell-cafe] Newbie question: can laziness lead to space compression?

2007-12-29 Thread Daniel Fischer
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

Re: [Haskell-cafe] newbie question about list performance

2007-10-29 Thread Jules Bean
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

Re: [Haskell-cafe] Newbie Question on Setting the GHC Search Path

2007-10-29 Thread Benjamin L. Russell
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

Re: [Haskell-cafe] Newbie Question on Setting the GHC Search Path

2007-10-29 Thread Stefan O'Rear
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

Re: [Haskell-cafe] Newbie Question on Setting the GHC Search Path

2007-10-29 Thread Olivier Boudry
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

Re: [Haskell-cafe] Newbie Question on Setting the GHC Search Path

2007-10-29 Thread Benjamin L. Russell
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.

[Haskell-cafe] newbie question about list performance

2007-10-28 Thread John Lato
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

[Haskell-cafe] Newbie Question on Setting the GHC Search Path

2007-10-28 Thread Benjamin L. Russell
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

Re: [Haskell-cafe] newbie question about list performance

2007-10-28 Thread Don Stewart
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

[Haskell-cafe] Newbie question: Why gfoldl has this strange type?

2007-08-30 Thread Rodrigo Geraldo
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

Re: [Haskell-cafe] Newbie question: Why gfoldl has this strange type?

2007-08-30 Thread Ryan Ingram
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

Re: [Haskell-cafe] Newbie question: Why gfoldl has this strange type?

2007-08-30 Thread Ryan Ingram
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

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-23 Thread Bas van Dijk
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

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-21 Thread Andrew Coppin
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

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Lanny Ripple
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

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Lanny Ripple
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

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Stefan O'Rear
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

RE: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-19 Thread Peter Verswyvelen
: [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

[Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-18 Thread Peter Verswyvelen
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.

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-18 Thread Derek Elkins
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

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-18 Thread Chaddaï Fouché
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

[Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread peterv
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

Re: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread Tillmann Rendel
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.

Re: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread Arie Peterson
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 to increase the type-safety of your code, but the

Re: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread David F. Place
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:

RE: [Haskell-cafe] Newbie question (again!) about phantom types

2007-08-08 Thread peterv
: [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

[Haskell-cafe] Newbie question: multi-methods in Haskell

2007-08-06 Thread peterv
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

Re: [Haskell-cafe] Newbie question: multi-methods in Haskell

2007-08-06 Thread Brian Hulley
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,

Re: [Haskell-cafe] Newbie question: multi-methods in Haskell

2007-08-06 Thread Dan Weston
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

Re: [Haskell-cafe] Newbie question: multi-methods in Haskell

2007-08-06 Thread Tillmann Rendel
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

Re: [Haskell-cafe] Newbie question: multi-methods in Haskell

2007-08-06 Thread Brian Hulley
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

RE: [Haskell-cafe] Newbie question: multi-methods in Haskell

2007-08-06 Thread peterv
(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

Re: [Haskell-cafe] Newbie question: multi-methods in Haskell

2007-08-06 Thread Brian Hulley
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

Re: [Haskell-cafe] Newbie question about automatic memoization

2007-07-31 Thread Jules Bean
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

[Haskell-cafe] Newbie question about Haskell skills progress

2007-07-31 Thread peterv
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

RE: [Haskell-cafe] Newbie question about automatic memoization

2007-07-31 Thread peterv
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

Re: [Haskell-cafe] Newbie question about Haskell skills progress

2007-07-31 Thread Dougal Stanton
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   2   3   >