Re: [Haskell-cafe] How to preload the module of my own

2009-09-04 Thread zaxis
My module is not in any package. Your solution is VERY elegant. thanks! mf-hcafe-15c311f0c wrote: > > > echo ':load ~/money/Money.hs' >> ~/.ghci > > works for me. this adds a line to the startup script that loads a > file that is not in any package. if this module loads other modules, > yo

Re: [Haskell-cafe] How to preload the module of my own

2009-09-04 Thread mf-hcafe-15c311f0c
echo ':load ~/money/Money.hs' >> ~/.ghci works for me. this adds a line to the startup script that loads a file that is not in any package. if this module loads other modules, you may need to play with ':cd' in addition to ':load'. hope this helps, matthias On Fri, Sep 04, 2009 at 06:14:50PM

Re: [Haskell-cafe] How to preload the module of my own

2009-09-04 Thread Alexander Dunlap
On Fri, Sep 4, 2009 at 6:08 PM, zaxis wrote: > > I want to preload the module automatically when starting ghci. The module > located in ~/work directory contains some functions i use everyday. > > Now i use an alias: alias ghci='ghci -i ~/money/Money.hs' which works fine. > However i feel there may

[Haskell-cafe] How to preload the module of my own

2009-09-04 Thread zaxis
I want to preload the module automatically when starting ghci. The module located in ~/work directory contains some functions i use everyday. Now i use an alias: alias ghci='ghci -i ~/money/Money.hs' which works fine. However i feel there maybe are more elegant way. thanks! -- View this messa

Re: [Haskell-cafe] Native windowing for glut applications on OS X.

2009-09-04 Thread Brandon S. Allbery KF8NH
On Sep 4, 2009, at 03:13 , Lyndon Maydwell wrote: I recently updated glut through cabal to version GLUT-2.2.1.0, and where once I had native windowing, now I can only seem to use X11. Does anyone know how to use native windowing? Do you use Fink or MacPorts? Check for OpenGL libraries instal

Re: [Haskell-cafe] forkM fails

2009-09-04 Thread Daniel Fischer
Am Samstag 05 September 2009 00:06:50 schrieb Alberto G. Corona: > Hi > > I need to execute a procedure not in the IO monad, but in an any monad: > > I defined: > > forkM :: Monad m=> m a -> IO ThreadId > forkM proc=forkIO $ proc `seq` return() > > I assumed that seq will force the evaluation of

Re: [Haskell-cafe] forkM fails

2009-09-04 Thread Dan Weston
Try >> instead of `seq`. Alberto G. Corona wrote: Hi I need to execute a procedure not in the IO monad, but in an any monad: I defined: forkM :: Monad m=> m a -> IO ThreadId forkM proc=forkIO $ proc `seq` return() I assumed that seq will force the evaluation of proc and after, it will dis

[Haskell-cafe] forkM fails

2009-09-04 Thread Alberto G. Corona
Hi I need to execute a procedure not in the IO monad, but in an any monad: I defined: forkM :: Monad m=> m a -> IO ThreadId forkM proc=forkIO $ proc `seq` return() I assumed that seq will force the evaluation of proc and after, it will discard his type (m a) and return () in the IO monad.as

[Haskell-cafe] ANN: HStringTemplate 0.6.2

2009-09-04 Thread Sterling Clover
I haven't sent out a release announcement for HStringTemplate in some time. In that time, there's been a host of new users, and consequently a host of feature requests and bug reports. Among the relatively recent changes: * Simple quasiquotation. * Proper unicode support (files are read in UTF-8,

Re: [Haskell-cafe] How do I fix this error message?

2009-09-04 Thread Peter Verswyvelen
Although also a bit of a global hack, you could also hide one of the packages using ghc-pkg hide mtl-1.1.02 instead of uninstalling them I think. Also, if you make a cabal file, you could specify the exact module you want to use. On Fri, Sep 4, 2009 at 11:03 PM, Michael Vanier wrote: > Hi ever

[Haskell-cafe] How do I fix this error message?

2009-09-04 Thread Michael Vanier
Hi everyone, I ran into this error when recompiling some code I hadn't worked on in a while: Foo.hs:19:7: Could not find module `Control.Monad.Error': it was found in multiple packages: monads-fd-0.0.0.1 mtl-1.1.0.2 I gather that monads-fd is supposed to be a replacement for mtl, but

Re: [Haskell-cafe] NFData question

2009-09-04 Thread Daniel Fischer
Am Freitag 04 September 2009 21:57:27 schrieb Peter Verswyvelen: > When ones makes an ADT with data constructors that has strict (and > maybe unpacked) fields, > > e.g. > > data Vec2 a = Vec2 {-# UNPACK #-} !a {-# UNPACK #-} !a > > how does one define an NFData instance? > > Like this? > > instanc

Re: [Haskell-cafe] Is this Parsec code idiomatic?

2009-09-04 Thread Daniel Fischer
Am Freitag 04 September 2009 21:23:35 schrieb Serge LE HUITOUZE: > Hi Haskellers, > > I'm asking some advice on a small piece of code representing a > simplified version of a treatment I need to perform. > I have a line-oriented string/file, from which I want to extract > only a substring of those

Re: [Haskell-cafe] NFData question

2009-09-04 Thread Jason Dagit
On Fri, Sep 4, 2009 at 12:57 PM, Peter Verswyvelen wrote: > When ones makes an ADT with data constructors that has strict (and > maybe unpacked) fields, > > e.g. > > data Vec2 a  = Vec2 {-# UNPACK #-} !a {-# UNPACK #-} !a > > how does one define an NFData instance? > > Like this? > > instance NFDat

Re: [Haskell-cafe] Is this Parsec code idiomatic?

2009-09-04 Thread Ben Moseley
Or for a bit of variety: selectPlus s = [cs | ('+':cs) <- lines s] --Ben On 4 Sep 2009, at 20:40, Martijn van Steenbergen wrote: Hi Serge, Serge LE HUITOUZE wrote: I'm asking some advice on a small piece of code representing a simplified version of a treatment I need to perform. I have a li

[Haskell-cafe] NFData question

2009-09-04 Thread Peter Verswyvelen
When ones makes an ADT with data constructors that has strict (and maybe unpacked) fields, e.g. data Vec2 a = Vec2 {-# UNPACK #-} !a {-# UNPACK #-} !a how does one define an NFData instance? Like this? instance NFData a => NFData (Vec2 a) where rnf (Vec2 x y) = rnf x `seq` rnf y Or is it e

Re: [Haskell-cafe] Is this Parsec code idiomatic?

2009-09-04 Thread Martijn van Steenbergen
Hi Serge, Serge LE HUITOUZE wrote: I'm asking some advice on a small piece of code representing a simplified version of a treatment I need to perform. I have a line-oriented string/file, from which I want to extract only a substring of those lines starting with char '+' (the detail of the extrac

[Haskell-cafe] Is this Parsec code idiomatic?

2009-09-04 Thread Serge LE HUITOUZE
Hi Haskellers, I'm asking some advice on a small piece of code representing a simplified version of a treatment I need to perform. I have a line-oriented string/file, from which I want to extract only a substring of those lines starting with char '+' (the detail of the extraction is irrelevant he

Re: [Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread Miguel Mitrofanov
Just copypasted it from my own email. Works fine. On 4 Sep 2009, at 20:05, Grigory Sarnitskiy wrote: This time I've checked that it really compiles. Pretty much sure it works. But how?! I'can't compile it: test.hs:11:2: Conflicting definitions for `put'' Bound at: test.hs:11:2-5

[Haskell-cafe] greencard error message

2009-09-04 Thread mf-hcafe-15c311f0c
greetings, greencard is confusing me: I copied an example from the command line and was hoping to look at some generated Haskell code to understand what's going on, but got this instead: | $ cat M1.gc | module M1 where | %enum PosixError Int [EACCES, ENOENT] | $ greencard M1.gc | greencard: user

Re: [Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread Grigory Sarnitskiy
Well, I've managed to produce a solution, quite ugly and unefficient. Still it works (and I really need it). StdGen serialization occurs only once during computation that lasts several hours, so the speed is not vital for me. Here is my solution: module Main where import System.Random import D

Re: [Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread Grigory Sarnitskiy
> This time I've checked that it really compiles. Pretty much sure it works. But how?! I'can't compile it: test.hs:11:2: Conflicting definitions for `put'' Bound at: test.hs:11:2-5 test.hs:13:2-5 test.hs:20:2-5 In the default-methods for class Binary' tes

Re: [Haskell-cafe] Re: Snow Leopard breaks GHC

2009-09-04 Thread Tom Tobin
On Fri, Sep 4, 2009 at 10:38 AM, Christian Maeder wrote: > Or "runghc" form /usr/bin? /usr/bin/runghc is a symlink to the same file as runhaskell. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] haskelldb + sqlite problem.

2009-09-04 Thread Colin Paul Adams
> "Magicloud" == Magicloud Magiclouds > writes: Magicloud> Hi, I am using haskelldb and Magicloud> haskelldb-hdbc-sqlite3. Well, I finally got the source Magicloud> compiled and ran, I got this error: App: user error Magicloud> (SQL error: SqlError {seState = "", seNative

Re: [Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread kyra
Miguel Mitrofanov wrote: Well, normally - you can't (unless there is some equivalent to the constructor exported). But there is a trick. You can use generic classes: {-# OPTIONS_GHC -fglasgow-exts -XGenerics -package lang #-} import Generics class Binary' a where put' :: a -> Put get' :: G

[Haskell-cafe] Re: Snow Leopard breaks GHC

2009-09-04 Thread Christian Maeder
Or "runghc" form /usr/bin? Christian Maeder wrote: > Maybe runhaskell is used for template haskell? > > HTH Christian > > Brian Sniffen wrote: >> No, my ghci is now "exec >> /Library/Frameworks/GHC.framework/Versions/610/usr/bin/ghc-6.10.4 >> -optc-m32 -opta-m32 -optl-m32 --interactive ${1+"$@"}

[Haskell-cafe] Re: Snow Leopard breaks GHC

2009-09-04 Thread Christian Maeder
Maybe runhaskell is used for template haskell? HTH Christian Brian Sniffen wrote: > No, my ghci is now "exec > /Library/Frameworks/GHC.framework/Versions/610/usr/bin/ghc-6.10.4 > -optc-m32 -opta-m32 -optl-m32 --interactive ${1+"$@"}" and I still see > the same result. Also, I have switched to "-

[Haskell-cafe] Re: Snow Leopard breaks GHC

2009-09-04 Thread Brian Sniffen
No, my ghci is now "exec /Library/Frameworks/GHC.framework/Versions/610/usr/bin/ghc-6.10.4 -optc-m32 -opta-m32 -optl-m32 --interactive ${1+"$@"}" and I still see the same result. Also, I have switched to "--ld-options" instead of "--ld-option," which appears to have been a typo---cabal and setup n

Re: [Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread Miguel Mitrofanov
You're right. The issue you've mentioned can be fixed easily - import Data.Generics instead of Generics and get rid of -package lang (I've copied them from the documentation without checking, seems like it's a bit outdated). The real problem is that you can't use "Get a" in generics! And you

Re: [Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread Grigory Sarnitskiy
> {-# OPTIONS_GHC -fglasgow-exts -XGenerics -package lang #-} Got some problems: Could not find module `Generics': it is a member of package ghc-6.8.2, which is hidden Failed, modules loaded: none. and for ghci test.hs -fglasgow-exts -XGenerics -package lang ghc-6.8.2: unknown packag

[Haskell-cafe] Re: Snow Leopard breaks GHC

2009-09-04 Thread Christian Maeder
Does adding -optc-m32 -opta-m32 -optl-m32 to /usr/bin/ghci as well not help? (as I've posted before) Cheers Christian Brian Sniffen wrote: > Having edited the Haskell Platform's /usr/bin/ghc in place, most > packages install fine. I'm still having trouble with Pandoc, even > given the advice: >

[Haskell-cafe] Re: Snow Leopard breaks GHC

2009-09-04 Thread Brian Sniffen
Having edited the Haskell Platform's /usr/bin/ghc in place, most packages install fine. I'm still having trouble with Pandoc, even given the advice: > Once cabal works, options --ld-option=-m32 (and also --gcc-option=-m32) > may be used. These options may also be passed to "./Setup configure" Th

Re: [Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread Miguel Mitrofanov
Well, normally - you can't (unless there is some equivalent to the constructor exported). But there is a trick. You can use generic classes: {-# OPTIONS_GHC -fglasgow-exts -XGenerics -package lang #-} import Generics class Binary' a where put' :: a -> Put get' :: Get a put' {| Unit |} Uni

[Haskell-cafe] How to derive instance for type without exported constructor?

2009-09-04 Thread Grigory Sarnitskiy
In System.Random StdGen is defined as data StdGen = StdGen Int32 Int32 but its constructor StdGen is not exported. How to make StdGen to be an instance of Binary? The following won't work: instance Data.Binary.Binary StdGen where put (StdGen aa ab) = do Data.Binary.put aa

[Haskell-cafe] ANN: fclabels-0.4.0 - First class accessor labels.

2009-09-04 Thread Sebastiaan Visser
Hello all, IFCP is a really inspiring place to hang/hack around with your fellow Haskell hackers. So, straight from Edinburgh, I proudly present a new release of fclabels[1,2], your favourite record selector package. This version is joint work with Chris Eidhof and Sjoerd Visscher. This p

Re: [Haskell-cafe] Problem on existential type.

2009-09-04 Thread Jochem Berndsen
Miguel Mitrofanov wrote: > Your data type GridWidget doesn't have a parameter, yet you use it like > it has one. > >> data GridWidget = forall widget. (WidgetClass widget) => GridWidget >> widget > ^ > | > NB:-+ This is allowed as long as you have enabl

[Haskell-cafe] Native windowing for glut applications on OS X.

2009-09-04 Thread Lyndon Maydwell
Hi haskell-cafe. I recently updated glut through cabal to version GLUT-2.2.1.0, and where once I had native windowing, now I can only seem to use X11. Does anyone know how to use native windowing? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org h

Re: [Haskell-cafe] Problem on existential type.

2009-09-04 Thread Roel van Dijk
The only knowledge the type system has about a GridWidget is that it contains /some thing/ which is a member of the WidgetClass typeclass. So the only thing you can do with the thing inside the GridWidget is to apply functions of the WidgetClass. It might be easier to see with the Show class instea