[Haskell-cafe] instance MonadFix GenParser

2009-02-22 Thread Paul Johnson
I want to write a parser for a Haskell-like type language. Amongst other things this means having a symbol table of top-level declarations. So for instance I want to be able to write in my type language: > type Foo = Bar Int > > data Bar a = Bar String a I can come up with a parser tha

Re: [Haskell-cafe] instance MonadFix GenParser

2009-02-22 Thread Paul Johnson
Oops. The last code sample should have been > parseDeclarations :: Parser [Declaration] > parseDeclarations = mdo > decls <- many ParseDeclaration symbols > let symbols = makeSymbolTable decls > return decls ___ Haskell-Cafe mailing

[Haskell-cafe] pkgenv - disposable, isolated pkg environments

2009-02-22 Thread Paolo Losi
Hi all, I've been recently toying with a small tool inspired by the Python tool virtualenv [1]. What it basically allows to do is to setup isolated, disposable package environments. You can find a small session example in: http://www.haskell.org/haskellwiki/PkgEnv The main benefits should be:

Re: [Haskell-cafe] Stacking StateTs

2009-02-22 Thread Luis O'Shea
test3 :: MonadState Integer m => String -> m String Good point. It's interesting that this allows the signature of test5b to become MonadState Integer m => m Integer (instead of (Monad m) => StateT Integer (StateT String m) Integer) which is more general, and (surprisingly to me) does not

[Haskell-cafe] jhc speed

2009-02-22 Thread John A. De Goes
Is there any conceivable factoring of GHC that would allow you to sandwich the core of jhc in between the front and back ends of GHC? Or are the architectures so fundamentally incompatible as to make this impossible? Such a factoring would be one way the community could help, and if suc

Re: [Haskell-cafe] jhc speed

2009-02-22 Thread Peter Verswyvelen
Would it be possible to separate the frontend (Haskell to Core) and backend (Core to machine code) from the Haskell compilers (requiring a standard Core language?) I'm not sure how many extensions required a change to the Core language. Most likely this is nice in theory but hard in practice? O

Re: [Haskell-cafe] jhc speed

2009-02-22 Thread John Meacham
On Sun, Feb 22, 2009 at 07:25:26AM -0700, John A. De Goes wrote: > > Is there any conceivable factoring of GHC that would allow you to > sandwich the core of jhc in between the front and back ends of GHC? Or > are the architectures so fundamentally incompatible as to make this > impossible?

Re: [Haskell-cafe] instance MonadFix GenParser

2009-02-22 Thread Luke Palmer
On Sun, Feb 22, 2009 at 3:31 AM, Paul Johnson wrote: > > parseDeclarations :: Parser [Declaration] > > parseDeclarations = mdo > > decls <- many ParseDeclaration symbols > let symbols = makeSymbolTable decls > > return decls Given a MonadFix instance, keep in mind that you s

Re: [Haskell-cafe] jhc speed

2009-02-22 Thread John Meacham
On Sun, Feb 22, 2009 at 03:36:34PM +0100, Peter Verswyvelen wrote: > Would it be possible to separate the frontend (Haskell to Core) and backend > (Core to machine code) from the Haskell compilers (requiring a standard Core > language?) > I'm not sure how many extensions required a change to the Co

Re: [Haskell-cafe] jhc speed

2009-02-22 Thread Luke Palmer
On Sun, Feb 22, 2009 at 8:15 AM, John Meacham wrote: > On Sun, Feb 22, 2009 at 03:36:34PM +0100, Peter Verswyvelen wrote: > > Would it be possible to separate the frontend (Haskell to Core) and > backend > > (Core to machine code) from the Haskell compilers (requiring a standard > Core > > langua

Re: [Haskell-cafe] jhc speed

2009-02-22 Thread John A. De Goes
I think doing this work would improve the design of GHC by improving modularity and factoring out generalized abstractions. The richest possible core language makes the most sense for a common core, because what's not needed can always be discarded. From your description, it sounds like s

Re: [Haskell-cafe] pkgenv - disposable, isolated pkg environments

2009-02-22 Thread Duncan Coutts
On Sun, 2009-02-22 at 13:22 +0100, Paolo Losi wrote: > To test it, download it from > > http://bitbucket.org/pao/pkgenv/raw/488bfe8e58dd/pkgenv > > chmod a+x and drop to an executable directory. > > Any feedback would be really appreciated. > Is this useful at all? > Are there better ways to re

[haskell-cafe] Finding a PID in Windows

2009-02-22 Thread Alexandru Scvortov
Quick question. In Linux, if you want to find the PID of a process, you use getProcessID from System.Posix.Process. How do you do the same under Windows? I cannot find the equivalent function in System.Win32 and searching Google does not yield any useful results. Thanks. _

Re: [haskell-cafe] Finding a PID in Windows

2009-02-22 Thread Bulat Ziganshin
Hello Alexandru, Sunday, February 22, 2009, 7:38:31 PM, you wrote: > In Linux, if you want to find the PID of a process, you use getProcessID from "The GetCurrentProcessId function returns the process identifier of the calling process. DWORD GetCurrentProcessId(VOID)" you need to make FFI imp

[Haskell-cafe] Re: pkgenv - disposable, isolated pkg environments

2009-02-22 Thread Paolo Losi
Duncan Coutts wrote: Would it be useful to have cabal-install check a env var for its config file? Definitely yes. This would allow dropping the dependency on bash aliasing and make porting to Windows fairly easy. Thanks Paolo ___ Haskell-Cafe mail

Re: [Haskell-cafe] Stacking StateTs

2009-02-22 Thread David Menendez
On Sun, Feb 22, 2009 at 9:20 AM, Luis O'Shea wrote: >> test3 :: MonadState Integer m => String -> m String > > Good point. It's interesting that this allows the signature of test5b to > become MonadState Integer m => m Integer (instead of (Monad m) => StateT > Integer (StateT String m) Integer) w

[Haskell-cafe] Re: [Haskell] ANNOUNCE: X Haskell Bindings 0.2

2009-02-22 Thread Achim Schneider
Felipe Lessa wrote: > On Sun, Feb 22, 2009 at 2:08 AM, Antoine Latter > wrote: > > The goal of XHB is to provide a Haskell implementation of the X11 > > wire protocol, similar in spirit to the X protocol C-language > > Binding (XCB). > [snip] > > Related projects: > > > > X C Bindings: http://xc

Re: [Haskell-cafe] Stacking StateTs

2009-02-22 Thread Daniel Fischer
Am Sonntag, 22. Februar 2009 18:53 schrieb David Menendez: > On Sun, Feb 22, 2009 at 9:20 AM, Luis O'Shea wrote: > >> test3 :: MonadState Integer m => String -> m String > > > > Good point. It's interesting that this allows the signature of test5b to > > become MonadState Integer m => m Integer (

Re: [Haskell-cafe] Stacking StateTs

2009-02-22 Thread Felipe Lessa
On Sun, Feb 22, 2009 at 3:17 PM, Daniel Fischer wrote: > test5b :: (Monad (StateT [Char] (StateT s m)), > MonadState s (StateT s m), > Num s, > Monad m) => > m s Doesn't 'Monad m' imply 'MonadState s (StateT s m)' which implies 'Monad (StateT s m)' which imp

[Haskell-cafe] Re: pkgenv - disposable, isolated pkg environments

2009-02-22 Thread Duncan Coutts
On Sun, 2009-02-22 at 18:38 +0100, Paolo Losi wrote: > Duncan Coutts wrote: > > > Would it be useful to have cabal-install check a env var for its config > > file? > > Definitely yes. > This would allow dropping the dependency on bash aliasing and > make porting to Windows fairly easy. Ok, I've

Re: [Haskell-cafe] Stacking StateTs

2009-02-22 Thread Daniel Fischer
Am Sonntag, 22. Februar 2009 19:29 schrieb Felipe Lessa: > Did I make any mistakes? No, I did. I didn't read it properly, saw the "MonadState s ..." there and thought it was MonadState s m instead of MonadState s (StateT s m). Sorry, Daniel ___ Haskel

[Haskell-cafe] Practise of hiding contsructors and serialization

2009-02-22 Thread Marc Weber
While working on extending scion I got some trouble and wonder which is the best way to do this? I have to pass a compilation result from a scion process instance to the scion daemon process. Of course I'd just like to use a simple Read Show for that. However I can't because two datatypes are Nomi

Re: [Haskell-cafe] Practise of hiding contsructors and serialization

2009-02-22 Thread Luke Palmer
On Sun, Feb 22, 2009 at 12:55 PM, Marc Weber wrote: > While working on extending scion I got some trouble and wonder which is > the best way to do this? > > I have to pass a compilation result from a scion process instance to the > scion daemon process. Of course I'd just like to use a simple Rea

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: X Haskell Bindings 0.2

2009-02-22 Thread Antoine Latter
On Sun, Feb 22, 2009 at 11:58 AM, Achim Schneider wrote: > > I once thought of hacking away on exactly that, but got demotivated by > the fact that all that xlib code would have to be replaced (including > xmonad-contrib). While nowadays xlib programs are compatible with xcb, > because xlib itself

Re: [Haskell-cafe] Hoogle and Network.Socket

2009-02-22 Thread Neil Mitchell
Hi I don't want to get in to a platform war (which I certainly don't have time to engage in - plus its not nearly as much fun over email vs sitting in a pub with some beer having a platform war). Martijn's thoughts of +windows, +unix, +os is exactly right, I'm happy to let users say "oh, please sh

Re: [Haskell-cafe] Hoogle and Network.Socket

2009-02-22 Thread Claus Reinke
sitting in a pub with some beer having a platform war). Martijn's thoughts of +windows, +unix, +os is exactly right, I'm happy to let users say "oh, please show me these packages", but there are trade-offs in Hoogle design. If someone has some clear viewpoint on the answers, I'd love to hear them.

Re: [Haskell-cafe] Hoogle and Network.Socket

2009-02-22 Thread Thomas DuBuisson
On Sun, Feb 22, 2009 at 1:04 PM, Neil Mitchell wrote: > 1) What packages should Hoogle search by default? At the very least - all of the Haskell Platform. If/when it searches more (+hackage flag?), perhaps the results could be ordered to place the HP functions first. > 2) What groups of package

Re: [Haskell-cafe] ANNOUNCE: pqueue-mtl, stateful-mtl

2009-02-22 Thread Henning Thielemann
On Fri, 20 Feb 2009, Louis Wasserman wrote: Hmmm.  That's probably a better framework to draw on for the general array interface. For a list of all such low-level arrays, see: http://www.haskell.org/haskellwiki/Storable_Vector StorableVectors can also be manipulated in ST monad.__

[Haskell-cafe] Error on instance of Control.Exception.Exception

2009-02-22 Thread Maurí­cio
Hi, I read here: www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html that this is declared: --- class (Typeable e, Show e) => Exception e where toException :: e -> SomeException fromException :: SomeException -> Maybe e --- I understand this means Excepton is a clas

Re: [Haskell-cafe] Error on instance of Control.Exception.Exception

2009-02-22 Thread Felipe Lessa
On Sun, Feb 22, 2009 at 9:41 PM, Maurí­cio wrote: > www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html These are the docs for the latest GHC version. > Type constructor `Exception' used as a class > In the instance declaration for `Exception DbError' What GHC version do

Re: [Haskell-cafe] Practise of hiding contsructors and serialization

2009-02-22 Thread Marc Weber
>I usually use Data.Binary for serialization. Sure. But you can't derive Data.Binary easily for NominalDiffTime. That's the point. You can only do so by using toReal or by adding data MyOwnPico = MyOwnPico only to create serialization instances. I don't like this kind of code duplication.. Mar

Re: [Haskell-cafe] Practise of hiding contsructors and serialization

2009-02-22 Thread Alexander Dunlap
On Sun, Feb 22, 2009 at 5:23 PM, Marc Weber wrote: >>I usually use Data.Binary for serialization. > Sure. But you can't derive Data.Binary easily for NominalDiffTime. > That's the point. You can only do so by using toReal or by adding > data MyOwnPico = MyOwnPico only to create serialization i

[Haskell-cafe] Fwd: cabal-install and bash scripts in windows- Was: Re: pkgenv - disposable, isolated pkg environments

2009-02-22 Thread Alberto G. Corona
Forwarded to the list: By the way, there are important packages such are haskell plugins, that have also this same single obstacle for workining under Windows. Many have basically the same bash script that test the type of c compiler, which fails miserably under windows: example output: checking