Re: [Haskell-cafe] Existential question

2011-08-18 Thread Ryan Ingram
On Wed, Aug 17, 2011 at 4:49 PM, Tom Schouten wrote: > {-# LANGUAGE ExistentialQuantification #-} > > -- Dear Cafe, this one works. > data Kl' s i o = Kl' (i -> s -> (s, o)) > iso' :: (i -> Kl' s () o) -> Kl' s i o > iso' f = Kl' $ \i s -> (\(Kl' kl') -> kl' () s) (f i) > > -- Is there a way to m

[Haskell-cafe] custom SQL-to-Haskell type conversion in HDBC

2011-08-18 Thread Henry House
Does there exist any sample code or other resources on writing a custom SQL-to-Haskell datatype converter instance for use with HDBC that would be accessible to someone just starting with Haskell? The reason I need this is because of this problem (using PostgreSQL): Prelude Database.HDBC.PostgreSQ

Re: [Haskell-cafe] Failed link to mixed-language shared object.

2011-08-18 Thread Brandon Allbery
On Thu, Aug 18, 2011 at 23:32, David Banas wrote: > Does this trigger recollection in anyone: > > dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ make > ghc -dynamic -o ami_test -L. -lami ami_test.o > ./libami.so: undefined reference to `__stginit_haskell98_MarshalArray_' > ./libami.so: undefin

[Haskell-cafe] Failed link to mixed-language shared object.

2011-08-18 Thread David Banas
Hi all, Does this trigger recollection in anyone: dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ make ghc -dynamic -o ami_test -L. -lami ami_test.o ./libami.so: undefined reference to `__stginit_haskell98_MarshalArray_' ./libami.so: undefined reference to `__stginit_haskell98_MarshalError_' co

Re: [Haskell-cafe] Embedding Perl RegEx in Haskell

2011-08-18 Thread Brandon Allbery
On Thu, Aug 18, 2011 at 14:01, C K Kashyap wrote: > *Main> let re = listToSequence [ hello, oneOrMore world, hello ] > *Main> re > hello(world)+hello > > I am looking for suggestions on how I could encode the anchors - ^ and $ > and also how I could refer to captures. My goal is to be able to ext

Re: [Haskell-cafe] Compilation error in Chapter 5 of "Real World Haskell"

2011-08-18 Thread Thomas DuBuisson
This is a linking issue. It seems GHC 7 automatically feeds the linker SimpleJSON.o so when you explicitly provide it too then you get those conflicts. All you need to do is call: > ghc -o simple Main.hs Unless you're using GHC 6, then the original command is correct: > ghc -o simple Main.hs S

Re: [Haskell-cafe] Compilation error in Chapter 5 of "Real World Haskell"

2011-08-18 Thread Jason Dagit
On Wed, Aug 17, 2011 at 10:37 AM, Paul Reiners wrote: > I'm trying to do the following from Chapter 5 of "Real World Haskell": > > Our choice of naming for the source file and function is deliberate. To > create an executable, ghc expects a module named Main that contains a > function named main.

[Haskell-cafe] Embedding Perl RegEx in Haskell

2011-08-18 Thread C K Kashyap
Dear Haskell folks, I was attempting to do an EDSL that would allow me to describe regular expressions in Hakell and generate Perl as target - https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/edsl/regex.hs $ ghci regex.hs GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for

Re: [Haskell-cafe] writing a good Setup.hs is *hard* (was: broken on install encoding 0.6.6)

2011-08-18 Thread malcolm.wallace
On 17 Aug, 2011,at 03:11 PM, Rogan Creswick wrote:encoding-0.6.6 uses it's own source during the build process! It actually has to be partially compiled before the build tool can build encoding (!). I'm *amazed* that this actually works at all (impressed, too),  This is by design.  It is intended

[Haskell-cafe] Gaussian elimination

2011-08-18 Thread Tobias Nipkow
Hi, I came up with the following extremely compact version of Gaussian elimination for matrices represented as functions. I searched the web but found nothing resembling it, probably because of its inefficiency. Has anybody seen something like it before? Thanks Tobias gauss :: Int -> (Int -> Int

Re: [Haskell-cafe] conditionally exposing modules in cabal

2011-08-18 Thread Rogan Creswick
On Thu, Aug 18, 2011 at 4:41 AM, Antoine Latter wrote: > One problem to consider - a downstream user of the new features won't > know that they need to pass special flags to your module, and may not > even know that they are using your module if the dependency is a few > steps removed. The situat

Re: [Haskell-cafe] conditionally exposing modules in cabal

2011-08-18 Thread Antoine Latter
On Thu, Aug 18, 2011 at 3:33 AM, Rogan Creswick wrote: > I would like to conditionally expose a number of internal modules in a > library depending on a cabal flag - the idea is that new features > could be implemented externally to the library without contaminating > the source with undesirable c

[Haskell-cafe] conditionally exposing modules in cabal

2011-08-18 Thread Rogan Creswick
I would like to conditionally expose a number of internal modules in a library depending on a cabal flag - the idea is that new features could be implemented externally to the library without contaminating the source with undesirable changes. However, I've been unable to find a way to structure a

Re: [Haskell-cafe] Existential question

2011-08-18 Thread Miguel Mitrofanov
> Now, what we can do with kl1? We can feed it an integer, say 1, and > obtain function f of the type s -> (s,Bool) for an _unknown_ type s. > Informally, that type is different from any concrete type. We can > never find the Bool result produced by that function since we can > never have any concr

Re: [Haskell-cafe] FFI question - FunPtrs to top-level functions

2011-08-18 Thread kyra
On 8/18/2011 6:49 AM, Antoine Latter wrote: Hi Haskell, I have a question about the Haskell FFI and creating FunPtrs to Haskell functions. Does anyone have any recommendations for when I have a top-level function that I would like to pass to a C function as a function pointer (that is called vi