Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 8, 2010, at 02:16 , Ivan Lazar Miljenovic wrote: David Menendez writes: That does not invoke fail. Let's take a simpler example: do { x <- Nothing; stmt }. This translates to let ok x = do { stmt } ok _ = fail "..." in Nothing >>= ok By the definition of (>>=) for Maybe, 'ok'

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
David Menendez writes: > That does not invoke fail. > > Let's take a simpler example: do { x <- Nothing; stmt }. This translates to > > let > ok x = do { stmt } > ok _ = fail "..." > in Nothing >>= ok > > By the definition of (>>=) for Maybe, 'ok' is never called. As I said in another ema

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread David Menendez
On Sat, May 8, 2010 at 1:16 AM, Ivan Lazar Miljenovic wrote: > David Menendez writes: > >> On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic >>> Well, any time you have a do-block like this you're using failable >>> patterns: >>> >>> maybeAdd       :: Maybe Int -> Maybe Int -> Maybe Int >>>

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Evan Laforge
> On the one hand, this is doable with the GHC API.  On the other, that more > or less means your program contains what amounts to a full copy of GHC. And the result is that your binary will grow by 35mb, add a few seconds to launch time, the first expression will take 3 or 4 seconds to evaluate,

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
"Brandon S. Allbery KF8NH" writes: > On May 8, 2010, at 01:16 , Ivan Lazar Miljenovic wrote: >> Huh? What about "maybeAdd (Just 2) Nothing" ? > > Isn't that handled by the definition of (>>=) in Maybe, as opposed to > by invoking fail? > >> instance Monad Maybe where >> -- ... >> Nothing >>=

[Haskell-cafe] Re: IO (Either a Error) question

2010-05-07 Thread Maciej Piechotka
On Fri, 2010-05-07 at 19:26 -0700, John Meacham wrote: > On Fri, May 07, 2010 at 08:27:04PM -0400, Dan Doel wrote: > > Personally, I don't really understand why unfailable patterns were canned > > (they don't seem that complicated to me), so I'd vote to bring them back, > > and > > get rid of fail

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 8, 2010, at 01:16 , Ivan Lazar Miljenovic wrote: David Menendez writes: On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic Well, any time you have a do-block like this you're using failable patterns: maybeAdd :: Maybe Int -> Maybe Int -> Maybe Int maybeAdd mx my = do x <- mx

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
David Menendez writes: > On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic >> Well, any time you have a do-block like this you're using failable >> patterns: >> >> maybeAdd :: Maybe Int -> Maybe Int -> Maybe Int >> maybeAdd mx my = do x <- mx >>y <- my >>

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread David Menendez
On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic wrote: > David Menendez writes: >> >> I wonder how often people rely on the use of fail in pattern matching. >> Could we get by without fail or unfailable patterns? >> >> ensureCons :: MonadPlus m => [a] -> m [a] >> ensureCons x@(_:_) = retur

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
David Menendez writes: > > I wonder how often people rely on the use of fail in pattern matching. > Could we get by without fail or unfailable patterns? > > ensureCons :: MonadPlus m => [a] -> m [a] > ensureCons x@(_:_) = return x > ensureCons _ = mzero > > do ... > x:xs <- ensureCons $ some_c

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
Limestraël writes: >> Personally I think fail is a terrible wart, and should be shunned. > > So do I. > I can't understand its purpose since monads which can fail can be > implemented through MonadPlus. Polyparse uses it, and I believe Parsec does as well... -- Ivan Lazar Miljenovic ivan.milje

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 7, 2010, at 22:18 , Limestraël wrote: When using hint, one wants the script to be interpreted. It is interpreted when called " loadModules ["Script"] ", but if we call later " interpret something (as :: Something) ", the something can be any Haskell code, not just a function name, whic

[Haskell-cafe] installing haskell platform on 64-bit ubuntu 10.04 (Lucid)

2010-05-07 Thread Andy Lee
Has anyone had problems getting Haskell Platform installed on Ubuntu 10.04? I've got GHC 6.12.1 installed via apt-get, and I've downloaded/untarred haskell-platform-2010.1.0.0.tar.gz. But when I run ./configure, it fails fairly quickly, with an error 'cause it can't build the "hello world" t

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread David Menendez
On Fri, May 7, 2010 at 10:26 PM, John Meacham wrote: > On Fri, May 07, 2010 at 08:27:04PM -0400, Dan Doel wrote: >> Personally, I don't really understand why unfailable patterns were canned >> (they don't seem that complicated to me), so I'd vote to bring them back, and >> get rid of fail. But hin

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread John Meacham
On Fri, May 07, 2010 at 08:27:04PM -0400, Dan Doel wrote: > Personally, I don't really understand why unfailable patterns were canned > (they don't seem that complicated to me), so I'd vote to bring them back, and > get rid of fail. But hind sight is 20/20, I suppose (or perhaps there exist > cogen

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Limestraël
You might have misunderstood me. When using hint, one wants the script to be interpreted. It is interpreted when called " loadModules ["Script"] ", but if we call later " interpret *something* (as :: Something) ", the *something *can be any Haskell code, not just a function name, which means hint

Re: [Haskell-cafe] darcs to mercurial migration

2010-05-07 Thread Marc Weber
Hi Günther, tehre is a fast darcs to git tool. Maybe you can convert to mercurial easily then. Ping me on irc (MarcWeber) or write back if you're interested. I'll digg the link up then. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] ANN: test-framework 0.3.0

2010-05-07 Thread Gregory Collins
Max Bolingbroke writes: > I'm pleased to announce the release of version 0.3 of test-framework > (http://hackage.haskell.org/package/test-framework-0.3.0). > ... > * There is a new command line option (--plain), which tells the test > runner to avoid using any ANSI features - this can be handy

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 4, 2010, at 12:31 , Gregory Crosswhite wrote: On May 4, 2010, at 5:22 AM, John Lato wrote: "Crashing at the point of the error" isn't necessarily useful in Haskell due to lazy evaluation. The code will crash when the result of the partial function is evaluated, which may be quite far awa

[Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Andy Stewart
Daniel Fischer writes: > On Wednesday 05 May 2010 23:36:26, Limestraël wrote: >> but you will not object if I say that scheme is quicker to learn >> than Haskell. > > Well, I do object. Learning Haskell went like a breeze (not to perfection, > but well enough). Only Python was nearly as easy and

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 3, 2010, at 12:14 , Henning Thielemann wrote: Ketil Malde schrieb: Henning Thielemann writes: http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Control-Exception.html#v%3Athrow I see. This should be forbidden, at all! :-) Why is this worse than or different from 'e

[Haskell-cafe] Haskell interface to Frama-C

2010-05-07 Thread Tom Hawkins
I just started using Frama-C [1] for analyzing some of our embedded C programs. Pretty awesome suite of tools. Especially its ability to describe and verify function contracts with ACSL [2]. The tool suite is primarily build with OCaml. Has anyone considered building a Haskell interface to Fram

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Pierre-Etienne Meunier
There is a also a problem with polymorphic actions of functions. The GHC API is typesafe only when returning elements of the Typeable class. Else you can do an unsafeCoerce, but I assume that hint uses Typeable, with a wrapper class to ensure monomorphism. But if your "script" action returns a

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Pierre-Etienne Meunier
By the way, I do not know the GHC API well enough to say if it is possible to embed a super small bytecode interpreter, but : - If it is the case, then users who do not want to write scripts can use it. Others would want to compile haskell code, therefore they need GHC anyway. - If it is not, th

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Pierre-Etienne Meunier
Shit ! I'll have to explain him how to add monads in python 3 ;-) El 07/05/2010, a las 19:31, Brandon S. Allbery KF8NH escribió: > On May 5, 2010, at 21:49 , Pierre-Etienne Meunier wrote: >> - all these >>=, significative indentation, You're from the past dude. > > > Careful, or Guido (van Ros

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Dan Doel
On Friday 07 May 2010 7:54:21 pm Limestraël wrote: > > Personally I think fail is a terrible wart, and should be shunned. > > So do I. > I can't understand its purpose since monads which can fail can be > implemented through MonadPlus. Understanding why fail exists requires going back to before H

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 7, 2010, at 19:54 , Limestraël wrote: > Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. The translation of "do" syntax involves pattern matching ("do { [x,y,

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ross Paterson
On Sat, May 08, 2010 at 01:54:21AM +0200, Limestraël wrote: > > Personally I think fail is a terrible wart, and should be shunned. > > So do I. > I can't understand its purpose since monads which can fail can be implemented > through MonadPlus. It was introduced to implement pattern match failure

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 7, 2010, at 19:51 , Limestraël wrote: then interpret "script" (as :: ScriptFun) There is just the line I put in bold that bothers me. Can't we get the action "script" more easily than by re-interpreting some code? Make up your mind: you don't want to have to compile the script

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Gregory Crosswhite
On May 7, 2010, at 4:54 PM, Limestraël wrote: > > Personally I think fail is a terrible wart, and should be shunned. > > So do I. > I can't understand its purpose since monads which can fail can be implemented > through MonadPlus. As far as I can tell, its purpose is to essentially allow you t

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Limestraël
> Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. 2010/5/8 Ross Paterson > On Sat, May 08, 2010 at 07:49:57AM +1000, Ivan Lazar Miljenovic wrote: > > Limestraėl writes:

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Limestraël
There is the package hint, which embeds the calls to GHC API. Quite easy to use: Let's say your configuration file (cfg/Script.hs) contains a function "script" that you want to get: type ScriptFun = IO () loadScript :: IO ScriptFun loadScript = do liftM (either (error . show) id) $ runInterpre

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 6, 2010, at 11:08 , Donn Cave wrote: different ambitions. Who would pick Tcl for a programming language? but it has been popular for scripting (still? don't know.) It would I think Lua has superseded it, because it has the compactness advantage and easy embeddability of of the Tcl c

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 5, 2010, at 21:49 , Pierre-Etienne Meunier wrote: - all these >>=, significative indentation, You're from the past dude. Careful, or Guido (van Rossum) is going to show up on your doorstep -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administra

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ross Paterson
On Sat, May 08, 2010 at 07:49:57AM +1000, Ivan Lazar Miljenovic wrote: > Limestraël writes: > > 2010/5/1 John Millikin > > > >> You might want to make a local version of ErrorT in your library, to > >> avoid the silly 'Error' class restriction. This is pretty easy; just > >> copy it from the 'tra

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 4, 2010, at 01:52 , Maciej Piechotka wrote: After change of file you have to wait a long time as it compiles and links with yi. On my system (1 GB of RAM taken by system + 1 GB 'free' + 2 GB swaps, x86-64) it could in some situations it caused OOM. I'd prefer if the code was interpreted

Re: [Haskell-cafe] Would it be evil to add "deriving Typeable" to newtype Q?

2010-05-07 Thread Mike Dillon
begin Ivan Lazar Miljenovic quotation: > Neil Mitchell writes: > > You might want to try Derive > > (http://community.haskell.org/~ndm/derive) if DrIFT doesn't work for > > you. They do roughly the same jobs, but Derive has more output formats > > (it can be spliced in as Template Haskell, generat

Re: [Haskell-cafe] Shorthand method of enumerating a list a gotcha ... or is it just me?

2010-05-07 Thread Roel van Dijk
>From the Haskell 98 report (section 6.3.4): > For Float and Double, the semantics of the enumFrom family is given by the > rules for Int above, except that the list terminates when the elements become > greater than e3+i/2 for positive increment i, or > when they become less > than e3+i/2 f

Re: [Haskell-cafe] Shorthand method of enumerating a list a gotcha ... or is it just me?

2010-05-07 Thread Ivan Lazar Miljenovic
Gene A writes: > The problem I see is that in both: > Version: September 2006 of hugs, which is the one that is current for > Ubuntu 9.10 release, and > ghci 6.10.4, they both exhibit a {I think} strange behaviour, in regards > to the shorthand way of calling out a list of enumerable values. I

[Haskell-cafe] Shorthand method of enumerating a list a gotcha ... or is it just me?

2010-05-07 Thread Gene A
The problem I see is that in both: Version: September 2006 of hugs, which is the one that is current for Ubuntu 9.10 release, and ghci 6.10.4, they both exhibit a {I think} strange behaviour, in regards to the shorthand way of calling out a list of enumerable values. I will explain the problem th

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
Limestraël writes: > 2010/5/1 John Millikin > >> You might want to make a local version of ErrorT in your library, to >> avoid the silly 'Error' class restriction. This is pretty easy; just >> copy it from the 'transformers' or 'mtl' package. >> > Yes, I wonder why mtl is not updated so as to rem

Re: [Haskell-cafe] GHC 6.12 on OS X 10.5

2010-05-07 Thread Jason Dagit
On Mon, Dec 28, 2009 at 9:03 AM, Aaron Tomb wrote: > > On Dec 22, 2009, at 9:36 PM, wren ng thornton wrote: > > Aaron Tomb wrote: >> >>> I've come across the issue with iconv, as well. >>> The problem seems to be that some versions of iconv define iconv_open and >>> some related functions as mac

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Limestraël
Yes, I wonder why mtl is not updated so as to remove this restriction. 2010/5/1 John Millikin > You might want to make a local version of ErrorT in your library, to > avoid the silly 'Error' class restriction. This is pretty easy; just > copy it from the 'transformers' or 'mtl' package. > _

Re: [Haskell-cafe] Would it be evil to add "deriving Typeable" to newtype Q?

2010-05-07 Thread Ivan Lazar Miljenovic
Neil Mitchell writes: > You might want to try Derive > (http://community.haskell.org/~ndm/derive) if DrIFT doesn't work for > you. They do roughly the same jobs, but Derive has more output formats > (it can be spliced in as Template Haskell, generate #include files, > output text etc) more derivat

[Haskell-cafe] Re: ANN: test-framework 0.3.0

2010-05-07 Thread Simon Michael
On 5/7/10 10:49 AM, Max Bolingbroke wrote: * There is a new command line option (--plain), which tells the test runner to avoid using any ANSI features - this can be handy if you are (for example) viewing test output in Emacs Thanks! I'll use that in the next release of shelltestrunner. ___

[Haskell-cafe] Re: ANNOUNCE: network-protocol-xmpp 0.3

2010-05-07 Thread John Millikin
On Fri, May 7, 2010 at 10:09, Sergei Trofimovich wrote: > 1. gsasl hackage package did not build for me against libgsasl-0.2.28. >    It did not define _MAJOR _MINOR macros, So I had to update >    up to libgsasl-1.4 which worked fine. Is there way to put constraints >    to pkgconfig-depends to .

Re: [Haskell-cafe] Would it be evil to add "deriving Typeable" to newtype Q?

2010-05-07 Thread Neil Mitchell
Hi Leonel, You might want to try Derive (http://community.haskell.org/~ndm/derive) if DrIFT doesn't work for you. They do roughly the same jobs, but Derive has more output formats (it can be spliced in as Template Haskell, generate #include files, output text etc) more derivations (but not quite o

Re: [Haskell-cafe] {-# LANGUAGE DeriveApplicative #-} ?

2010-05-07 Thread Neil Mitchell
Hi, If you think you can write an algorithm for deriving Applicative, I'd welcome you to try adding it to Derive: http://community.haskell.org/~ndm/derive The Functor/Foldable/Traversable derivations all started out in Derive, got tested/implemented/refined there, then moved to GHC later. I think

[Haskell-cafe] ANN: test-framework 0.3.0

2010-05-07 Thread Max Bolingbroke
I'm pleased to announce the release of version 0.3 of test-framework (http://hackage.haskell.org/package/test-framework-0.3.0). This package provides a nice test runner for HUnit, QuickCheck 1 and QuickCheck 2 tests. To see a detailed example of the runner in action, please check out our website a

[Haskell-cafe] Re: ANNOUNCE: network-protocol-xmpp 0.3

2010-05-07 Thread Sergei Trofimovich
On Mon, 3 May 2010 07:43:25 -0700 John Millikin wrote: > My library, network-protocol-xmpp[2], is an implementation of most of > RFC 3920 and a bit of RFC 3921. It supports opening client-to-server > and component-to-server sessions, which is useful for implementing > XMPP-based clients. This lib

Re: [Haskell-cafe] darcs to mercurial migration

2010-05-07 Thread Jason Dagit
On Fri, May 7, 2010 at 2:29 AM, Nicolas Pouillard < nicolas.pouill...@gmail.com> wrote: > On Thu, 06 May 2010 01:08:08 +0200, Günther Schmidt > wrote: > > Hello, > > > > I'm switching from darcs to mercurial with some of my projects. > > > > I'd like to retain as much of the history as possible,

Re: [Haskell-cafe] accents

2010-05-07 Thread Daniel Fischer
On Friday 07 May 2010 17:05:08, Dupont Corentin wrote: > Hello, > i'm still struggling with ghci and accents. > > Prelude> "é" > "\233" That uses the Show instance of Char, which escapes all characters greater than '\127' ('\DEL'), so that's no problem, jut inconvenient. > > I've installed GHC 6

[Haskell-cafe] Type system game (was: Nomic game in Haskell)

2010-05-07 Thread Dupont Corentin
Hello, I think your type should be: type Board a b c d e f g h i = Either (Three a b c) (Either (Three d e f) (Either (Three g h i) (Either (Three a d g) (Either (Three b e h) (Either (Three c f i) (Either (Three a e i) (Three c e g))) as far as i can understand, it

Re: [Haskell-cafe] accents

2010-05-07 Thread Dupont Corentin
Hello, i'm still struggling with ghci and accents. Prelude> "é" "\233" I've installed GHC 6.12.1, which gave me a better result: Prelude> putStrLn "é" é but still: Prelude> "é" "\233" I'm trying to search a file with french words with Regex, but i stumble on accents: *Main> findRegexFile "ab

[Haskell-cafe] Re: [Long, probably not-beginners anymore] Parallel folds and folds as arrows (was: Re: [Haskell-beginners] Re: When, if ever, does Haskell "calculate once"?)

2010-05-07 Thread Daniel Fischer
On Friday 07 May 2010 16:15:41, Daniel Fischer wrote: > b) using Don Stewart's ghc-core (http://hackage.haskell.org/package/ghc- > core), e.g. ghc.core -f html -- -O2 Source.hs > Source.html And of course, the html backend of ghc-core was removed with version 0.5 :( If you want html output, $ caba

[Haskell-cafe] Re: [Long, probably not-beginners anymore] Parallel folds and folds as arrows (was: Re: [Haskell-beginners] Re: When, if ever, does Haskell "calculate once"?)

2010-05-07 Thread Daniel Fischer
On Friday 07 May 2010 03:15:19, Maciej Piechotka wrote: > On Thu, 2010-05-06 at 23:46 +0200, Daniel Fischer wrote: > > Share.share :: GHC.Types.Int > > GblId > > [Str: DmdType] > > Share.share = > > case GHC.List.$wlen @ GHC.Integer.Type.Integer Share.share_a 0 > > of ww_amc { __DEFAULT -> > >

Re: [Haskell-cafe] ANNOUNCE: gt-tools-0.1.4

2010-05-07 Thread Max Rabkin
On Fri, May 7, 2010 at 4:12 AM, Felipe Lessa wrote: > On Thu, May 06, 2010 at 09:30:50PM +0300, Sergei Trofimovich wrote: >> /me wonders if Miss lambdabot might like to have such functionality. >> What do you think? > > Do the terms of use of Google Translate allow it? I can't remember, but they

Re: [Haskell-cafe] Database connection pool

2010-05-07 Thread Michael Snoyman
On Fri, May 7, 2010 at 1:02 AM, Bas van Dijk wrote: > On Thu, May 6, 2010 at 11:54 PM, Bas van Dijk > wrote: > > On Thu, May 6, 2010 at 7:48 PM, Bas van Dijk > wrote: > >> On Thu, May 6, 2010 at 3:24 PM, Michael Snoyman > wrote: > >>> > >>> > >>> On Thu, May 6, 2010 at 9:13 AM, Bryan O'Sulliva

[Haskell-cafe] Mirror repository for gtk2hs

2010-05-07 Thread Andy Stewart
Hi all, Because code.haskell.org is unstable recently, and many gtk2hs users can't get code from http://code.haskell.org/gtk2hs So i build a mirror repository at http://patch-tag.com/r/AndyStewart/gtk2hs-sync-mirror/home You can access this mirror repository when code.haskell.org down. This mir

Re: [Haskell-cafe] darcs to mercurial migration

2010-05-07 Thread Nicolas Pouillard
On Thu, 06 May 2010 01:08:08 +0200, Günther Schmidt wrote: > Hello, > > I'm switching from darcs to mercurial with some of my projects. > > I'd like to retain as much of the history as possible, what tools are > there available for this? I recommend you darcs-fast-export and then use the/a mer