[Haskell-cafe] Reply to

2009-05-05 Thread Ashok Gautham
I feel that the haskell mailing lists must have the reply-to field set, so that a person can reply to the list by just clicking reply. I am unsure if I am the only one facing this problem. --- Ashok `ScriptDevil` Gautham ___ Haskell-Cafe mailing list Ha

Re: [Haskell-cafe] Writing a compiler in Hakell

2009-05-05 Thread Jason Dagit
On Tue, May 5, 2009 at 11:07 PM, Rouan van Dalen wrote: > > Hi everyone. > > I am designing my own programming language. > > I would like to know what is the best way to go about writing my compiler in > haskell. > What are the tools available in haskell that can help with compiler > constructio

Re: [Haskell-cafe] Writing a compiler in Hakell

2009-05-05 Thread jean-christophe mincke
Hello Rouan My bible : The dragon book of Aho, Sethi & Ullman http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools Regards J-C On Wed, May 6, 2009 at 8:07 AM, Rouan van Dalen wrote: > > Hi everyone. > > I am designing my own programming language. > > I would like to know

Re: [Haskell-cafe] Writing a compiler in Hakell

2009-05-05 Thread Luke Palmer
On Wed, May 6, 2009 at 12:07 AM, Rouan van Dalen wrote: > > Hi everyone. > > I am designing my own programming language. > > I would like to know what is the best way to go about writing my compiler > in haskell. > What are the tools available in haskell that can help with compiler > construction?

Re: [Haskell-cafe] Writing a compiler in Hakell

2009-05-05 Thread minh thu
2009/5/6 Rouan van Dalen : > > Hi everyone. > > I am designing my own programming language. > > I would like to know what is the best way to go about writing my compiler in > haskell. > What are the tools available in haskell that can help with compiler > construction? > > I know about Happy. Is

[Haskell-cafe] Writing a compiler in Hakell

2009-05-05 Thread Rouan van Dalen
Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? The compiler is in

[Haskell-cafe] ANNOUNCE: The Haskell Platform

2009-05-05 Thread Don Stewart
We're pleased to announce the first release of the Haskell Platform: a single, standard Haskell distribution for every system. Download the Haskell Platform 2009.2.0 installers and specification: http://hackage.haskell.org/platform/ The Haskell Platform is a blessed library and tool suite f

[Haskell-cafe] Re: runhaskell CLI parameters

2009-05-05 Thread mail
"Vasili I. Galchin" writes: > Hello, > > I have forgotten the runhaskell CLI parameters ... sigh. In particular I > want to a "local" build of a set of of package: > > runhaskell Setup.hs configure --user??? > > I just did a "runhaskell -?" which didn't tell me a lot! Try runhaskel

Re: [Haskell-cafe] runhaskell CLI parameters

2009-05-05 Thread Brandon S. Allbery KF8NH
On May 5, 2009, at 23:39 , Vasili I. Galchin wrote: I have forgotten the runhaskell CLI parameters ... sigh. In particular I want to a "local" build of a set of of package: runhaskell Setup.hs configure --user??? That's not an option to runhaskell, but an option to Setup.hs.

[Haskell-cafe] runhaskell CLI parameters

2009-05-05 Thread Vasili I. Galchin
Hello, I have forgotten the runhaskell CLI parameters ... sigh. In particular I want to a "local" build of a set of of package: runhaskell Setup.hs configure --user??? I just did a "runhaskell -?" which didn't tell me a lot! Kind regards, Vasili __

Re: [Haskell-cafe] setResourceLimit

2009-05-05 Thread Brandon S. Allbery KF8NH
On May 5, 2009, at 04:52 , br...@lorf.org wrote: I have a long-lived multithreaded server process that needs to execute programs and interact with them via Handles. The programs could misbehave, like loop or hang, so I need to limit the real and CPU time they can take. I guess System.Posix.Resou

Re: [Haskell-cafe] Re: Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)

2009-05-05 Thread wren ng thornton
Chris Forno (jekor) wrote: The idea is that I spent years studying different languages, generally with a textbook. The textbooks tend to focus on teaching rules and grammar, with a little bit of vocabulary and dialog each chapter. I think the focus should be reversed. This varies wildly by text

Re: [Haskell-cafe] calling a variable length parameter lambda expression

2009-05-05 Thread Richard O'Keefe
On 6 May 2009, at 4:49 am, Nico Rolle wrote: Hi everyone. I have a problem. A function is recieving a lambda expression like this: (\ x y -> x > y) or like this (\ x y z a -> (x > y) && (z < a) Your first function has type Ord a => a -> a -> Bool so your list of parameters must have

Re: [Haskell-cafe] List comprehension

2009-05-05 Thread porges
2009/5/6 Bulat Ziganshin : Hello applebiz89, Tuesday, May 5, 2009, 7:20:35 PM, you wrote: filmsInGivenYear :: Int -> [Film] -> [String] filmsInGivenYear filmYear ?= [ title | year <- (Film title director year fans) , year == filmYear] (this code wont compile - error given '?Syntax error in e

Re: [Haskell-cafe] A brief note on n_k patterns and Hackage

2009-05-05 Thread Don Stewart
ok: > On 5 May 2009, at 8:30 pm, Magnus Therning wrote: > >> On Tue, May 5, 2009 at 1:04 AM, Richard O'Keefe >> wrote: >>> I never really understood why it was thought to be relevant, >>> but I was challenged to show that n+k patterns occurred in >>> Hackage. >> >> Why is it relevant? > > Some p

Re: [Haskell-cafe] A brief note on n_k patterns and Hackage

2009-05-05 Thread Richard O'Keefe
On 5 May 2009, at 8:30 pm, Magnus Therning wrote: On Tue, May 5, 2009 at 1:04 AM, Richard O'Keefe wrote: I never really understood why it was thought to be relevant, but I was challenged to show that n+k patterns occurred in Hackage. Why is it relevant? Some people think that the popular

Re: [Haskell-cafe] Thread on scala ml: Usefulness of OOP

2009-05-05 Thread Brandon S. Allbery KF8NH
On May 4, 2009, at 06:19 , Paolo Losi wrote: http://www.nabble.com/-scala--usefulness-of-OOP-td23268250.html Martin Odersky, scala creator, advocates the use of OOP using an interesting toy problem. I would be very interested about the haskell point of view on the topic. Is there any haskell

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Hartman
> half-assed state for a real state solution, there's follow up here: http://groups.google.com/group/haskell-cafe/browse_thread/thread/d6143504c0e80075 2009/5/5 Thomas Hartman : >> interact (\s -> let (first,second) = span (not . null) (lines s) >               in unlines ("first":first++"second

[Haskell-cafe] Re: Tests

2009-05-05 Thread John Goerzen
Guenther Schmidt wrote: > let me first of all thank you for providing the HDBC package. Haskell > would be a much, much less usefull language without a working database > interface. I could certainly not have written the app in Haskell > without it and in any other language I know writing this

Re: [Haskell-cafe] ANN: atom-0.0.3

2009-05-05 Thread Tom Hawkins
I pushed out a new version of atom that incorporates some of John's recommendations (thanks John). And it ships with a slightly better example. The release also includes means to extract code coverage to track which atom rules have fired during testing. -Tom http://hackage.haskell.org/cgi-bin/h

Re: [Haskell-cafe] ST.Lazy vs ST.Strict

2009-05-05 Thread Luke Palmer
On Tue, May 5, 2009 at 3:27 PM, Luke Palmer wrote: > On Sun, May 3, 2009 at 11:27 AM, Tobias Olausson wrote: > >> Hello! >> I have a program that is using ST.Strict, which works fine. >> However, the program needs to be extended, and to do that, >> lazy evaluation is needed. As a result of that,

Re: [Haskell-cafe] ST.Lazy vs ST.Strict

2009-05-05 Thread Luke Palmer
On Sun, May 3, 2009 at 11:27 AM, Tobias Olausson wrote: > Hello! > I have a program that is using ST.Strict, which works fine. > However, the program needs to be extended, and to do that, > lazy evaluation is needed. As a result of that, I have switched > to ST.Lazy to be able to do stuff like

Re: [Haskell-cafe] Performance counters

2009-05-05 Thread minh thu
2009/5/5 Andrew Coppin : > Magnus Therning wrote: >> >> Andrew Coppin wrote: >>> >>> Stuff like "how many times does this function get called? How what's the >>> maximum depth it recurses to?" That kind of thing. >> >> It won't help you, but wouldn't it be the kind of thing that'd fit in the >> GHC

Re: [Haskell-cafe] ST.Lazy vs ST.Strict

2009-05-05 Thread Daniel Fischer
Am Dienstag 05 Mai 2009 21:42:00 schrieb Tobias Olausson: > This simple implementation of CPU does not behave as expected in the > latest version of ghc using ST.Lazy since it updates the `pc` in the > wrong order. > When we use ghc-6.8 the code works as expected both with lazy and strict > ST. Ho

Re: [Haskell-cafe] Performance counters

2009-05-05 Thread Andrew Coppin
Magnus Therning wrote: Andrew Coppin wrote: Stuff like "how many times does this function get called? How what's the maximum depth it recurses to?" That kind of thing. It won't help you, but wouldn't it be the kind of thing that'd fit in the GHC runtime? Do you also require that the counter

Re: [Haskell-cafe] ST.Lazy vs ST.Strict

2009-05-05 Thread Tobias Olausson
This simple implementation of CPU does not behave as expected in the latest version of ghc using ST.Lazy since it updates the `pc` in the wrong order. When we use ghc-6.8 the code works as expected both with lazy and strict ST. How is that? How do we fix this so we can use ghc-6.10. -- --

using interact with state, was Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Hartman
Aha! There is in fact a way to fit this specification into the applicative paradigm. I'm a bit muzzy as to what it all means, but I must say, aesthetically I'm rather pleased with the result: module Main where import Control.Monad.State import Control.Applicative import Control.Applicative.Stat

Re: [Haskell-cafe] calling a variable length parameter lambda expression

2009-05-05 Thread Ketil Malde
Nico Rolle writes: > A function is recieving a lambda expression like this: > (\ x y -> x > y) > or like this > (\ x y z a -> (x > y) && (z < a) And the type of that function is..? > my problem is now i know i have a list filled with the parameters for > the lambda expression. but how can i c

Re: FW: Re: [Haskell-cafe] calling a variable length parameter lambda expression

2009-05-05 Thread Ryan Ingram
On Tue, May 5, 2009 at 10:05 AM, Nico Rolle wrote: > I dont't understand why u ask me that but the lambda expression will > only get values not functions as a parameter. > a = 1 > b = 2 > c = 3 > >>> What if I call >>> a (+)? > > this won't happen in my use case. > regards nico Here's an example

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Hartman
> interact (\s -> let (first,second) = span (not . null) (lines s) in unlines ("first":first++"second":takeWhile (not.null) second)) So, that didn't quite do the right thing, and it seemed like using span/break wouldn't scale well for more than two iterations. Here's another attempt

Re: [Haskell-cafe] Parsec - Custom Fail

2009-05-05 Thread Daniel Fischer
Am Dienstag 05 Mai 2009 17:38:35 schrieb mwin...@brocku.ca: > Thanks, but I want a nice solution not another, even more complicated, > workaround. I'm afraid you're out of luck there. Parsec carries a ParseError around even for successful parses (where it's a SourcePos and and empty list of mes

Re: [Haskell-cafe] calling a variable length parameter lambda expression

2009-05-05 Thread Ryan Ingram
This is a Hard Problem in Haskell. Let me ask you, how many parameters does this function take? a = (\x -> x) How many parameters does this function take? b = (\f x -> f x) How many parameters does this function take? c = (\f x y -> f x y) What if I call a (+)? -- ryan On Tue, May 5, 2009 a

Re: [Haskell-cafe] calling a variable length parameter lambda expression

2009-05-05 Thread Miguel Mitrofanov
Short answer: that's impossible. Well, with some oleging it should be possible, but the very fact that you're trying to do something like this indicates that you're doing something wrong. Where did this list of parameters came from? May be, you can apply your function to them one at a time,

[Haskell-cafe] calling a variable length parameter lambda expression

2009-05-05 Thread Nico Rolle
Hi everyone. I have a problem. A function is recieving a lambda expression like this: (\ x y -> x > y) or like this (\ x y z a -> (x > y) && (z < a) my problem is now i know i have a list filled with the parameters for the lambda expression. but how can i call that expression? [parameters] is my

[Haskell-cafe] ANN: BUG FIX release of regex-tdfa-1.1.2

2009-05-05 Thread ChrisK
Hello, While occasionally and slowly updating the future version of regex-tdfa I found a bug that exists in the released 1.1.1 version. It was just a matter of passing the wrong value into a function, so was easy to fix when I figured it out. The test case triggered an impossible "error" ca

Re[2]: [Haskell-cafe] Interesting Thread on OO Usefulness (scala mailing list)

2009-05-05 Thread Bulat Ziganshin
Hello Wolfgang, Tuesday, May 5, 2009, 8:27:17 PM, you wrote: >> i know two problems in Haskell/GHC that require OO-loke features - >> extensible exceptions and GUI widget types hierarchy > Note that you don’t need different types for different kinds of GUI widgets if > you use Functional Reactiv

Re: [Haskell-cafe] Interesting Thread on OO Usefulness (scala mailing list)

2009-05-05 Thread Wolfgang Jeltsch
Am Montag, 4. Mai 2009 13:35 schrieb Bulat Ziganshin: > Hello Paolo, > > Monday, May 4, 2009, 2:05:44 PM, you wrote: > > Martin Odersky advocates the OO features of the scala language > > proposing an interesting problem where the OO approach seams > > valuable. > > i know two problems in Haskell/G

Re: [Haskell-cafe] A brief note on n_k patterns and Hackage

2009-05-05 Thread j3h
On Mon, May 4, 2009 at 5:23 PM, John Van Enk wrote: > Which package? In 1251 packages, I found 20 source files out of 15144 source files that use (n+k) patterns: queuelike-1.0.9/Data/Queue/Stack.hs queuelike-1.0.9/Data/Queue/TrieQueue.hs hinze-streams-1.0/Data/Stream/Hinze/Stream.hs compression-

Re: [Haskell-cafe] A brief note on n_k patterns and Hackage

2009-05-05 Thread Jason Dagit
On Tue, May 5, 2009 at 1:30 AM, Magnus Therning wrote: > On Tue, May 5, 2009 at 1:04 AM, Richard O'Keefe wrote: >> I never really understood why it was thought to be relevant, >> but I was challenged to show that n+k patterns occurred in >> Hackage. > > Why is it relevant? Showing that they occu

Re: [Haskell-cafe] List comprehension

2009-05-05 Thread Brent Yorgey
On Tue, May 05, 2009 at 05:36:12PM +0200, Tillmann Rendel wrote: > > PS. I'm not a native speaker, but shouldn't it be "movies" and not "films"? Both are correct. =) -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/ma

Re: [Haskell-cafe] Parsec - Custom Fail

2009-05-05 Thread mwinter
Thanks, but I want a nice solution not another, even more complicated, workaround. On 5 May 2009 at 17:10, Martijn van Steenbergen wrote: > mwin...@brocku.ca wrote: > > Hi, > > > > I am using parsec to parse a small programming language. The language is > > typed and > > I need to do some type

Re: [Haskell-cafe] List comprehension

2009-05-05 Thread Tillmann Rendel
Hi, applebiz89 wrote: > Hi, I think I need to use a list comprehension There is no need to use list comprehensions, there is always a way to express the same thing without them. In fact, list comprehensions are defined as syntactic shorthands for this other way. filmsInGivenYear :: Int -> [

Re: [Haskell-cafe] List comprehension

2009-05-05 Thread minh thu
2009/5/5 applebiz89 : > > Hi, I think I need to use a list comprehension for this function but Im not > good with list comprehension. this is what I have so at the moment? > > filmsInGivenYear :: Int -> [Film] -> [String] > filmsInGivenYear filmYear ?= [ title | year <- (Film title director year >

Re: [Haskell-cafe] List comprehension

2009-05-05 Thread Bulat Ziganshin
Hello applebiz89, Tuesday, May 5, 2009, 7:20:35 PM, you wrote: > filmsInGivenYear :: Int -> [Film] -> [String] > filmsInGivenYear filmYear ?= [ title | year <- (Film title director year > fans) , year == filmYear] (this code wont compile - error given '?Syntax > error in expression (unexpected `;

[Haskell-cafe] List comprehension

2009-05-05 Thread applebiz89
Hi, I think I need to use a list comprehension for this function but Im not good with list comprehension. this is what I have so at the moment? filmsInGivenYear :: Int -> [Film] -> [String] filmsInGivenYear filmYear ?= [ title | year <- (Film title director year fans) , year == filmYear] (this co

Re: [Haskell-cafe] Parsec - Custom Fail

2009-05-05 Thread Martijn van Steenbergen
mwin...@brocku.ca wrote: Hi, I am using parsec to parse a small programming language. The language is typed and I need to do some type checking, too. I have decided to do the parsing and type checking simultaneously in the my parsec parser. This approach avoids to keep source code positions i

Re: [Haskell-cafe] Parsec - Custom Fail

2009-05-05 Thread Neil Brown
Hi, When we needed to do something similar with Parsec, we chose to pack the relevant source position into the error string (you can just use Show/Read, plus a special sequence of characters to indicate where the position ends and the real error starts). We then unpack it outside runParser b

[Haskell-cafe] Parsec - Custom Fail

2009-05-05 Thread mwinter
Hi, I am using parsec to parse a small programming language. The language is typed and I need to do some type checking, too. I have decided to do the parsing and type checking simultaneously in the my parsec parser. This approach avoids to keep source code positions in the data type in order to

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Hartman
seems to be the same behavior whether in ghci or compiled with ghc. 2009/5/5 Ketil Malde : > Thomas Hartman writes: > >> That's slick, but is there some way to use interact twice in the same >> program? > > No :-) > >> t10 = >>   let f = unlines . takeWhile (not . blank) . lines >>   in  do putS

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Davie
I also tried t15 = let grabby = unlines . takeWhile (not . blank) . lines top = ("first time: " ++) . grabby . ("second time: " ++) . grabby in interact top but that didn't work either: thart...@ubuntu:~/haskell-learning/lazy-n-strict>runghc sequencing.hs a first time: second time:

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Ketil Malde
Thomas Hartman writes: > That's slick, but is there some way to use interact twice in the same program? No :-) > t10 = > let f = unlines . takeWhile (not . blank) . lines > in do putStrLn "first time" > interact f > putStrLn "second time" > interact f > > this re

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Hartman
That's slick, but is there some way to use interact twice in the same program? t10 = let f = unlines . takeWhile (not . blank) . lines in do putStrLn "first time" interact f putStrLn "second time" interact f this results in *** Exception: : hGetContents: illegal op

Re: [Haskell-cafe] Re: Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)

2009-05-05 Thread Daniel Carrera
Chris Forno (jekor) wrote: The idea is that I spent years studying different languages, generally with a textbook. The textbooks tend to focus on teaching rules and grammar, with a little bit of vocabulary and dialog each chapter. I think the focus should be reversed. I think it largely depends

Re: [Haskell-cafe] How to understand the fmap here ?

2009-05-05 Thread Bulat Ziganshin
Hello z_axis, Tuesday, May 5, 2009, 1:27:16 PM, you wrote: > floatLocation :: Window -> X (ScreenId, W.RationalRect) > > rr <- snd `fmap` floatLocation w > > class Functor f where fmap :: (a -> b) -> f a -> f b looks ok. X===f, fmap executes floatLocation w :: X (ScreenId, W.RationalRect) ===

Re: [Haskell-cafe] How to understand the fmap here ?

2009-05-05 Thread minh thu
2009/5/5 z_axis : > The following code snippets is from xmonad: > -- Given a window, find the screen it is located on, and compute > -- the geometry of that window wrt. that screen. > floatLocation :: Window -> X (ScreenId, W.RationalRect) > --... > rr <- snd `fmap` floatLocation w > > Prelude>

Re: [Haskell-cafe] How to understand the fmap here ?

2009-05-05 Thread Thomas Davie
On 5 May 2009, at 11:27, z_axis wrote: The following code snippets is from xmonad: -- Given a window, find the screen it is located on, and compute -- the geometry of that window wrt. that screen. floatLocation :: Window -> X (ScreenId, W.RationalRect) --... rr <- snd `fmap` floatLocation w

[Haskell-cafe] How to understand the fmap here ?

2009-05-05 Thread z_axis
The following code snippets is from xmonad: -- Given a window, find the screen it is located on, and compute -- the geometry of that window wrt. that screen. floatLocation :: Window -> X (ScreenId, W.RationalRect) --... rr <- snd `fmap` floatLocation w Prelude> :i fmap class Functor f where fm

[Haskell-cafe] setResourceLimit

2009-05-05 Thread brian
I have a long-lived multithreaded server process that needs to execute programs and interact with them via Handles. The programs could misbehave, like loop or hang, so I need to limit the real and CPU time they can take. I guess System.Posix.Resource.setResourceLimit sets limits on the current pro

Re: [Haskell-cafe] A brief note on n_k patterns and Hackage

2009-05-05 Thread Magnus Therning
On Tue, May 5, 2009 at 1:04 AM, Richard O'Keefe wrote: > I never really understood why it was thought to be relevant, > but I was challenged to show that n+k patterns occurred in > Hackage. Why is it relevant? /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.o

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Davie
On 4 May 2009, at 23:15, Thomas Hartman wrote: {-# LANGUAGE NoMonomorphismRestriction #-} import Data.List import Control.Monad import Control.Applicative -- Can the function below be tweaked to quit on blank input, provisioned in the applicative style? -- which function(s) needs to be rewritt

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread david48
On Mon, May 4, 2009 at 11:49 PM, Conor McBride wrote: > Remember folks: Missiles need miffy! Quote of the week ! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: StateT IO Action on `onKeyPress`

2009-05-05 Thread Andy Stewart
Ryan Ingram writes: > Something like this: > > -- Replaces "runStateT" for callbacks that might affect the state > invert :: IORef s -> StateT s IO a -> IO a > invert r m = do > s <- readIORef r > (a, s') <- runStateT m s > writeIORef r s' > return a > > -- Replaces "liftIO" when