[Haskell-cafe] Re: Suggestions for improvement

2010-10-03 Thread N. Raghavendra
At 2010-10-03T22:45:30+02:00, Dominique Devriese wrote: > Additionally, you can't combine the functions (blowup . allButLast) > and lastToTheLength into a function that returns a pair like you seem > to attempt. You need a function like the following for that: > > comma :: (a -> b) -> (a -> c) ->

Re: [Haskell-cafe] Big Arrays

2010-10-03 Thread John Millikin
On Sun, Oct 3, 2010 at 19:09, Bryan O'Sullivan wrote: > On Sun, Oct 3, 2010 at 11:54 AM, Henry Laxen > wrote: >> >> I am trying to create a (relatively) big array, >> but it seems I cannot make anything larger >> than 2^30 or so.  Here is the code: > > Use a 64-bit machine, where Int is 64 bits w

Re: Re[2]: [Haskell-cafe] EDSL for Makefile

2010-10-03 Thread C K Kashyap
> > mention_only_once file action = do >   want [file] >   file *> action > > main = mention_only_once "file1" $ \x -> do need ["file2"] >                                            putStrLn "Hello" >                                            putStrLn "World" > > Thanks Bulat I guess even th

Re: [Haskell-cafe] Problem with monad transformer stack

2010-10-03 Thread Michael Vanier
On 10/3/10 7:06 PM, Bryan O'Sullivan wrote: On Sun, Oct 3, 2010 at 9:40 PM, Michael Vanier > wrote: {- This doesn't work: -} newtype MyMonad a = MyMonad ((StateT (MyData a) (Either SomeError) a)) deriving (Monad, MonadState (MyData a

Re: [Haskell-cafe] Big Arrays

2010-10-03 Thread Bryan O'Sullivan
On Sun, Oct 3, 2010 at 11:54 AM, Henry Laxen wrote: > > I am trying to create a (relatively) big array, > but it seems I cannot make anything larger > than 2^30 or so. Here is the code: > Use a 64-bit machine, where Int is 64 bits wide. Trying to create a larger array on a 32-bit machine doesn't

Re: [Haskell-cafe] Problem with monad transformer stack

2010-10-03 Thread Bryan O'Sullivan
On Sun, Oct 3, 2010 at 9:40 PM, Michael Vanier wrote: > > {- This doesn't work: -} > newtype MyMonad a = > MyMonad ((StateT (MyData a) (Either SomeError) a)) > deriving (Monad, >MonadState (MyData a), >MonadError SomeError, >Typeable) > This simply isn't all

Re: [Haskell-cafe] Problem with monad transformer stack

2010-10-03 Thread Christopher Done
On 4 October 2010 03:40, Michael Vanier wrote: > newtype MyMonad a = >  MyMonad ((StateT (MyData a) (Either SomeError) a)) >  deriving (Monad, >            MonadState (MyData a), >            MonadError SomeError, >            Typeable) I think it's the `a'. I think it needs to be a concrete type

[Haskell-cafe] Problem with monad transformer stack

2010-10-03 Thread Michael Vanier
I'm having a problem with a simple monad transformer stack that has me stumped. Here's the sample code: {-# LANGUAGE GeneralizedNewtypeDeriving #-} import Control.Monad.Error import Control.Monad.State import Data.Typeable data SomeError = Error1 | Error2 | ErrorFail deriving (Eq,

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread wren ng thornton
On 10/3/10 5:52 PM, Victor Nazarov wrote: I suggest to pay more attention to haskell's standard library. "allButLast" is called "init" in Data.List module. Second, do not use explicit recursion. You can capture recursion using some high-order function like map, filter, foldr and so on: lastToT

[Haskell-cafe] Re: Haskell Helper

2010-10-03 Thread Ben Franksen
Ben Franksen wrote: > The type checker tells you that you are using the same Map with different > key types: at 52:17-19 the key has type [Hai], whereas at 47:16-18 it has > type Hai. > > The latter is in your Func case: s/latter/former/ ___ Haskell-Ca

[Haskell-cafe] Re: Re: A parsec question

2010-10-03 Thread Ben Franksen
Antoine Latter wrote: > On Sun, Oct 3, 2010 at 11:55 AM, Ben Franksen > wrote: >> Stephen Tetley wrote: >>> Does this one give the "expected" error message for Parsec3.1 - >>> unfortunately I can't test as I'm still using Parsec 2.1.0.1. >>> parser = block (many digit "digit") >> >> Unfortun

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-03 Thread Conal Elliott
I like it! Are the other sections available as well, e.g., (if False then else "Cafe") "Haskell" --> "Cafe" - Conal On Sat, Oct 2, 2010 at 11:23 AM, Max Bolingbroke wrote: > Hi Cafe, > > I implemented the proposed Haskell' feature lambda-case/lambda-if [1] > during the Haskell Implementor

Re: [Haskell-cafe] Re: A parsec question

2010-10-03 Thread Antoine Latter
On Sun, Oct 3, 2010 at 11:55 AM, Ben Franksen wrote: > Stephen Tetley wrote: >> Does this one give the "expected" error message for Parsec3.1 - >> unfortunately I can't test as I'm still using Parsec 2.1.0.1. >> >>> parser = block (many digit "digit") > > Unfortunately, no. > > Cheers > Ben > He

[Haskell-cafe] Re: Haskell Helper

2010-10-03 Thread Ben Franksen
c8h10n4o2 wrote: > The problem is there. A function in Hai would be function-name, > arg1,argn=body. > Func stores function name,arguments and body as Strings(I was thinking to > put Func String String String). > The parser func that I wrote so far try to parse a function definition, > not a functi

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Victor Nazarov
I suggest to pay more attention to haskell's standard library. "allButLast" is called "init" in Data.List module. Second, do not use explicit recursion. You can capture recursion using some high-order function like map, filter, foldr and so on: lastToTheLength xs = map f xs where f = const . l

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Gregory Crosswhite
On 10/3/10 2:24 PM, Dominique Devriese wrote: Or you can write it as (liftA2 (,)) as I noted a few lines further in my mail ;) Dominique I know, I just mentioned it to increase awareness of the fact that the instance methods for all the classes in Control.Arrow can equivalently be interpret

[Haskell-cafe] Re: Haskell Helper

2010-10-03 Thread c8h10n4o2
The problem is there. A function in Hai would be function-name, arg1,argn=body. Func stores function name,arguments and body as Strings(I was thinking to put Func String String String). The parser func that I wrote so far try to parse a function definition, not a function call. But when I try to s

[Haskell-cafe] Re: Haskell Helper

2010-10-03 Thread Ben Franksen
c8h10n4o2 wrote: > No, it is not secret. I'm having trouble to define functions. Take a look > at my code(please be gentle) > http://haskell.1045720.n5.nabble.com/file/n3100036/hai1.hs hai1.hs Can you explain in a few words what the Func constructor should represent why it has three arguments? I a

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Dominique Devriese
Gregory, 2010/10/3 Gregory Crosswhite : >  On 10/3/10 1:45 PM, Dominique Devriese wrote: >> >> Additionally, you can't combine the functions (blowup . allButLast) >> and lastToTheLength into a function that returns a pair like you seem >> to attempt. You need a function like the following for that

Re: [Haskell-cafe] Haskell Platform, Hackage and Cabal : The 2nd Year : Status Report

2010-10-03 Thread Vo Minh Thu
2010/10/3 Ketil Malde : > Matthias Kilian writes: > >>>     http://www.vimeo.com/15462768 > >> And is there any way to just *download* the video? For people not >> using adobe flash? > > +1.  I'd like to watch video offline on my phone, so Flash isn't really > a good option.  It doesn't work on my

Re: [Haskell-cafe] Haskell Platform, Hackage and Cabal : The 2nd Year : Status Report

2010-10-03 Thread Ketil Malde
Matthias Kilian writes: >> http://www.vimeo.com/15462768 > And is there any way to just *download* the video? For people not > using adobe flash? +1. I'd like to watch video offline on my phone, so Flash isn't really a good option. It doesn't work on my computer either, at least not witho

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Gregory Crosswhite
On 10/3/10 1:45 PM, Dominique Devriese wrote: Additionally, you can't combine the functions (blowup . allButLast) and lastToTheLength into a function that returns a pair like you seem to attempt. You need a function like the following for that: comma :: (a -> b) -> (a -> c) -> a -> (b,c) c

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Dominique Devriese
> One question I have is whether I can eliminate points in the above > definition of blowup, and write something like > >blowup = (++) . (blowup . allButLast, lastToTheLength) > > thinking of (++) as a function String x String -> String. Actually (++) is of type String -> String -> String. Whe

[Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-03 Thread Kevin Jardine
Luke, I had no idea polyvariadic functions would be controversial. Yes, in my original case the function would be trivial: toMonoid k = [toString k] I do prefer the less cluttered look. I think that (poly value1 value2 value3) is easier to follow when the values are all of related types (in m

Re: [Haskell-cafe] Big Arrays

2010-10-03 Thread Antoine Latter
On Sun, Oct 3, 2010 at 11:18 AM, Bulat Ziganshin wrote: > Hello Henry, > > Sunday, October 3, 2010, 7:54:49 PM, you wrote: > >> It looks like array ranges can only be Ints, and not Int64 or Word64 types. > > yes, it's Int internally got efficiency reasons. you can do your own > implementation to o

[Haskell-cafe] Suggestions for improvement

2010-10-03 Thread N. Raghavendra
I am reading the book `The Haskell Road to Math, Logic, ...". One of the exercises in the first chapter asks for a function that maps a string "abcd" to "abbccc" and "bang!" to "baannn!". Since such a function f fixes the empty word, and maps wa to f(w)a^(length(w)+1) for any word w a

Re: [Haskell-cafe] Polyvariadic functions operating with a monoid

2010-10-03 Thread Luke Palmer
On Sun, Oct 3, 2010 at 1:26 PM, Luke Palmer wrote: > On Sun, Oct 3, 2010 at 1:24 AM, Kevin Jardine wrote: >> I had a situation where I had some related types that all had toString >> functions. >> >> Of course in Haskell, lists all have to be composed of values of >> exactly the same type, so ins

Re: [Haskell-cafe] Polyvariadic functions operating with a monoid

2010-10-03 Thread Luke Palmer
On Sun, Oct 3, 2010 at 1:24 AM, Kevin Jardine wrote: > I had a situation where I had some related types that all had toString > functions. > > Of course in Haskell, lists all have to be composed of values of > exactly the same type, so instead of passing around lists of values > with these related

[Haskell-cafe] Re: Haskell Helper

2010-10-03 Thread c8h10n4o2
No, it is not secret. I'm having trouble to define functions. Take a look at my code(please be gentle) http://haskell.1045720.n5.nabble.com/file/n3100036/hai1.hs hai1.hs -- View this message in context: http://haskell.1045720.n5.nabble.com/Haskell-Helper-tp3093854p3100036.html Sent from the Has

Re: [Haskell-cafe] Haskell Helper

2010-10-03 Thread Daniel Peebles
Is the language secret? because I'm sure lots of people would like to help on this mailing list, but you'd need to tell us what help you need first :) On Sun, Oct 3, 2010 at 8:38 PM, Eduardo Ribeiro wrote: > Hello, > I 'm developing a new language in haskell and I need someone to help me. > Anyon

[Haskell-cafe] Haskell Helper

2010-10-03 Thread Eduardo Ribeiro
Hello, I 'm developing a new language in haskell and I need someone to help me. Anyone would like to help? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] A question regarding cmdargs package

2010-10-03 Thread Ben Franksen
How can I disable the standard arguments 'help' and 'version'? Cheers ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Re: Non-existing types in existential quantification?

2010-10-03 Thread Ben Franksen
Henning Thielemann wrote: > On Sun, 3 Oct 2010, Ben Franksen wrote: >> Christopher Done wrote: >> >>> Consider the following program: >>> >>> main = putStrLn $ show $ length [undefined :: a,undefined :: b] >>> >>> A concrete type of the element in list doesn't need to be determined >>> at runtime,

[Haskell-cafe] Re: A parsec question

2010-10-03 Thread Ben Franksen
Stephen Tetley wrote: > Does this one give the "expected" error message for Parsec3.1 - > unfortunately I can't test as I'm still using Parsec 2.1.0.1. > >> parser = block (many digit "digit") Unfortunately, no. Cheers Ben ___ Haskell-Cafe mailing li

Re: [Haskell-cafe] Big Arrays

2010-10-03 Thread Bulat Ziganshin
Hello Henry, Sunday, October 3, 2010, 7:54:49 PM, you wrote: > It looks like array ranges can only be Ints, and not Int64 or Word64 types. yes, it's Int internally got efficiency reasons. you can do your own implementation to override this limit :) -- Best regards, Bulat

[Haskell-cafe] Big Arrays

2010-10-03 Thread Henry Laxen
Dear Group, I am trying to create a (relatively) big array, but it seems I cannot make anything larger than 2^30 or so. Here is the code: import Data.Word import Data.Array.Unboxed import Control.Monad.ST import Data.Array.ST import Control.Exception import Prelude hiding (catch) t1 :: Word6

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Christopher Done
On 3 October 2010 17:41, Michael Snoyman wrote: > Well done, it all looks *very* nice. Regarding Yesod: yes, use the > cube for now, I may eventually make a better logo, but that's it for > the moment. Righteo. > The only concern I have is the "practical web programming > in Haskell" page, which

Re: [Haskell-cafe] Re: I still cannot seem to get a GUI working under Windows.

2010-10-03 Thread Steve Schafer
On Sat, 2 Oct 2010 11:02:21 -0700, you wrote: >I imagine someone looking at a lovely app and saying, "Wow -- great >interface! I bet it was programmed in Haskell." While I can agree with the sentiment...well, good luck with that. ;-) -Steve Schafer __

Re: [Haskell-cafe] I still cannot seem to get a GUI working under Windows.

2010-10-03 Thread Steve Schafer
On Fri, 01 Oct 2010 13:45:00 +0100, you wrote: >I think that the issue is that making things better on Windows (and >likely OS X as well) requires co-ordinated and agreed action across a >number of areas. This means getting a moderate number of people, most >of whom give up their time and effort f

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Michael Snoyman
On Sun, Oct 3, 2010 at 5:33 PM, Christopher Done wrote: > So I went through the Applications_and_libraries/Web_programming page > and pulled out any remaining goodness from it into pages under the > Web/ umbrella and then set it up as a redirect to Web/ > > I made an infobox which I put on every W

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Christopher Done
So I went through the Applications_and_libraries/Web_programming page and pulled out any remaining goodness from it into pages under the Web/ umbrella and then set it up as a redirect to Web/ I made an infobox which I put on every Web/ page, which makes it very nice for navigating between the sect

Re[2]: [Haskell-cafe] EDSL for Makefile

2010-10-03 Thread Bulat Ziganshin
Hello C, Sunday, October 3, 2010, 6:59:25 PM, you wrote: > Thanks Neil, >> main = do >>  want ["file1"] >>  "file1" *> \x -> do >>    need ["file2"] >>    putStrLn "Hello" >>    putStrLn "World" > What if I want to mention "file1" only once? mention_only_once file action = do  want [file]  f

Re: [Haskell-cafe] EDSL for Makefile

2010-10-03 Thread C K Kashyap
Thanks Neil, > main = do >  want ["file1"] >  "file1" *> \x -> do >    need ["file2"] >    putStrLn "Hello" >    putStrLn "World" What if I want to mention "file1" only once? -- Regards, Kashyap ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org h

Re: [Haskell-cafe] Re: EDSL for Makefile

2010-10-03 Thread C K Kashyap
On Sun, Oct 3, 2010 at 5:22 PM, steffen wrote: > If you don't want to mention "r1" explicitly, but want to refer to > "target", "sources" and such only a monadic approach (e.g. Reader > Monad) might be what you want. > Thanks Steffen ... would you be able to give me an example? -- Regards, Kash

Re: [Haskell-cafe] Re: Non-existing types in existential quantification?

2010-10-03 Thread Erik Hesselink
On Sun, Oct 3, 2010 at 14:10, Daniel Fischer wrote: > On Sunday 03 October 2010 10:43:24, Henning Thielemann wrote: >> On Sun, 3 Oct 2010, Ben Franksen wrote: >> > Christopher Done wrote: >> >> Consider the following program: >> >> >> >> main = putStrLn $ show $ length [undefined :: a,undefined ::

Re: [Haskell-cafe] EDSL for Makefile

2010-10-03 Thread Neil Mitchell
> I checked out the video - nice - but I think, understandably, since > its not open source yet, not much of implementations details were > mentioned. Yes, it's unfortunate. > So, I have this "unanswered question" nagging in my head. In the > example below, how can I let the makefile writer refer

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Christopher Done
I just discovered this: http://www.haskell.org/haskellwiki/Performance/Strictness See the Haskell Performance Resource box? That's great! I'm going to make one for our Web articles. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskel

Re: [Haskell-cafe] Coding conventions for Haskell?

2010-10-03 Thread Henning Thielemann
Andrew Coppin schrieb: > On 30/09/2010 02:56 PM, Henning Thielemann wrote: >> In Cabal you can write one module per line and need no separator or >> terminator at all. > > Really? As far as I can tell, that doesn't work at all... See e.g. http://hackage.haskell.org/packages/archive/utility-ht

Re: [Haskell-cafe] Re: Non-existing types in existential quantification?

2010-10-03 Thread Daniel Fischer
On Sunday 03 October 2010 10:43:24, Henning Thielemann wrote: > On Sun, 3 Oct 2010, Ben Franksen wrote: > > Christopher Done wrote: > >> Consider the following program: > >> > >> main = putStrLn $ show $ length [undefined :: a,undefined :: b] > >> > >> A concrete type of the element in list doesn't

[Haskell-cafe] Re: EDSL for Makefile

2010-10-03 Thread steffen
If you don't want to mention "r1" explicitly, but want to refer to "target", "sources" and such only a monadic approach (e.g. Reader Monad) might be what you want. On Oct 3, 6:14 am, C K Kashyap wrote: > > Thanks Emil ... yeah, that works...I was wondering what I could do to > > not have to menti

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Christopher Done
On 3 October 2010 12:31, Michael Snoyman wrote: > I think it's fair to say that turbinado is inactive. But keep in mind > that we should probably look at more than just the frameworks: > servers, templating, etc. Sure, it should be a general rule across the board.

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Michael Snoyman
On Sun, Oct 3, 2010 at 12:20 PM, Christopher Done wrote: > On 3 October 2010 12:10, Michael Snoyman wrote: >> I would actually do the opposite: we can put the libraries/frameworks >> that we are sure *are* active into the Active section and put >> everything else into Inactive. I have a feeling w

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Christopher Done
On 3 October 2010 12:10, Michael Snoyman wrote: > I would actually do the opposite: we can put the libraries/frameworks > that we are sure *are* active into the Active section and put > everything else into Inactive. I have a feeling we'll be pretty close > on the mark with our guesses; a quick lo

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Michael Snoyman
On Sun, Oct 3, 2010 at 11:59 AM, Christopher Done wrote: > On 3 October 2010 06:51, Michael Snoyman wrote: * Does pass.net still exist anywhere? Same for parallel web. >>> >>> I couldn't find any references to pass.net. >> >> http://www.haskell.org/haskellwiki/Web/Existing_software > > I mea

[Haskell-cafe] Re: Haskell web development entries on the Wiki

2010-10-03 Thread Christopher Done
On 3 October 2010 06:51, Michael Snoyman wrote: >>> * Does pass.net still exist anywhere? Same for parallel web. >> >> I couldn't find any references to pass.net. > > http://www.haskell.org/haskellwiki/Web/Existing_software I meant that I remember adding it, but I couldn't find any references for

Re: [Haskell-cafe] Re: Non-existing types in existential quantification?

2010-10-03 Thread Henning Thielemann
On Sun, 3 Oct 2010, Ben Franksen wrote: Christopher Done wrote: Consider the following program: main = putStrLn $ show $ length [undefined :: a,undefined :: b] A concrete type of the element in list doesn't need to be determined at runtime, or any time. a unifies with b, and that unifies wi

Re: [Haskell-cafe] A parsec question

2010-10-03 Thread Stephen Tetley
Does this one give the "expected" error message for Parsec3.1 - unfortunately I can't test as I'm still using Parsec 2.1.0.1. > parser = block (many digit "digit") ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/lis

[Haskell-cafe] Polyvariadic functions operating with a monoid

2010-10-03 Thread Kevin Jardine
I had a situation where I had some related types that all had toString functions. Of course in Haskell, lists all have to be composed of values of exactly the same type, so instead of passing around lists of values with these related types, I created a polyvariadic function polyToString so that I