Re: [Haskell-cafe] How to get subset of a list?

2006-12-07 Thread Gene A
On 11/30/06, Huazhi (Hank) Gong [EMAIL PROTECTED] wrote: Thanks, it make sense here. However, like I want to choose s[1,3,6,10] or something like this. Are there some straightforward function or operator for doing this job? The !! operator in haskell seems does not support multiple indecies.

[Haskell-cafe] Hac 2007 : Haskell Hackathon - extended registration

2006-12-07 Thread Donald Bruce Stewart
Hac 2007 The 2007 Haskell Hackathon January 10-12, 2007 Oxford University Computing Laboratory http://haskell.org/haskellwiki/Hac_2007 The deadline

[Haskell-cafe] Designing an object model in Haskell

2006-12-07 Thread John Ky
Hi, I've got an object model that I have a difficult time conceptualising how it might look like in Haskell: class Element { } class Inline : Element { } class ParentInline : Inline { ListInline children; } class Bold : ParentInline { } class Underline : ParentInline { } class Link :

[Haskell-cafe] computational time always 0.0 in this example...

2006-12-07 Thread Lennart
Hi, with the following code, I want to measure the time being needed to execute the algorithm. But the result is always 0.0. import Char (toLower) import Maybe import List ( delete, sort, intersect ) import System.CPUTime import Control.Exception import Debug.Trace fromInt = fromIntegral

Re: [Haskell-cafe] Designing an object model in Haskell

2006-12-07 Thread Jeff Polakow
Have you looked at OOHaskell (http://homepages.cwi.nl/~ralf/OOHaskell/)? -Jeff [EMAIL PROTECTED] wrote on 12/07/2006 07:07:46 AM: Hi, I've got an object model that I have a difficult time conceptualising how it might look like in Haskell: class Element { } class Inline : Element { }

Re: [Haskell-cafe] computational time always 0.0 in this example...

2006-12-07 Thread Philippa Cowderoy
On Thu, 7 Dec 2006, Lennart wrote: Hi, with the following code, I want to measure the time being needed to execute the algorithm. But the result is always 0.0. You need to do something to force the result of a, or it'll never actually get evaluated. Depending on the type in question, seq

Re: [Haskell-cafe] computational time always 0.0 in this example...

2006-12-07 Thread Lemmih
On 12/7/06, Lennart [EMAIL PROTECTED] wrote: Hi, with the following code, I want to measure the time being needed to execute the algorithm. But the result is always 0.0. import Char (toLower) import Maybe import List ( delete, sort, intersect ) import System.CPUTime import Control.Exception

Re: [Haskell-cafe] computational time always 0.0 in this example...

2006-12-07 Thread Bulat Ziganshin
Hello Lennart, Thursday, December 7, 2006, 4:59:57 PM, you wrote: time $ product [1..1000] `seq` return () instead of time $ doTest wordList2 wordList2 `seq` return () works fine. because 'product' returns just one value. use the following: time $ (return $! last (doTest wordList2

Re: [Haskell-cafe] computational time always 0.0 in this example...

2006-12-07 Thread Lemmih
On 12/7/06, Lennart [EMAIL PROTECTED] wrote: Hi, with the following code, I want to measure the time being needed to execute the algorithm. But the result is always 0.0. import Char (toLower) import Maybe import List ( delete, sort, intersect ) import System.CPUTime import Control.Exception

[Haskell-cafe] How to combine Error and IO monads?

2006-12-07 Thread Cat Dancer
I've read Jeff Newbern's tutorial on monad transformers (http://www.nomaware.com/monads/html/index.html), but I don't grok it yet and I can't tell how to get started with this particular requirement, or even if I need monad transformers for this. I have a program that performs a series of IO

[Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-07 Thread apfelmus
Cat Dancer wrote: I have a program that performs a series of IO operations, each which can result in an error or a value. If a step returns a value I usually want to pass that value on to the next step, if I get an error I want to do some error handling but usually want to skip the remaining

Re: [Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-07 Thread Cat Dancer
And you just rediscovered monad transformers. Can I use an existing monad transformer like ErrorT for this application? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-07 Thread Cat Dancer
On 12/7/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Cat Dancer wrote: I have a program that performs a series of IO operations, each which can result in an error or a value. If a step returns a value I usually want to pass that value on to the next step, if I get an error I want to do

Re: [Haskell-cafe] Re: How to combine Error and IO monads?

2006-12-07 Thread J. Garrett Morris
On 12/7/06, Cat Dancer [EMAIL PROTECTED] wrote: On 12/7/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm sure from a single example I could understand what was going on and elaborate from there. Let's say I want to get a line from the user, and either return an integer or an error string

[Haskell-cafe] STUArray's newArray_ breaks referential transparency

2006-12-07 Thread Stefan O'Rear
newArray_ allocates an array full of garbage. import Control.Monad.ST import Data.Array.ST import Data.Array tickle :: Int tickle = runST (do { x - newArray_ (0,100) ; (readArray :: STUArray s Int Int - Int - ST s Int) x 3 }) ___

[Haskell-cafe] interval arithmetic for integers?

2006-12-07 Thread Nicolas Frisby
I'm looking to not reinvent the wheel. Is there an existing package that supports interval arithmetic on integers (or more)? A possible complication is that I'm hoping to include open intervals such as (GreaterEqThan 3). If there's not a package to go with, any pointers on the appopriate rules

Re: [Haskell-cafe] interval arithmetic for integers?

2006-12-07 Thread Donald Bruce Stewart
nicolas.frisby: I'm looking to not reinvent the wheel. Is there an existing package that supports interval arithmetic on integers (or more)? A possible complication is that I'm hoping to include open intervals such as (GreaterEqThan 3). If there's not a package to go with, any pointers on

Re: [Haskell-cafe] interval arithmetic for integers?

2006-12-07 Thread Taral
Some of that is in the Ranged Sets library: http://ranged-sets.sourceforge.net/Ranged/ but it doesn't support Num. On 12/8/06, Nicolas Frisby [EMAIL PROTECTED] wrote: I'm looking to not reinvent the wheel. Is there an existing package that supports interval arithmetic on integers (or more)?