[Haskell-cafe] Alternatives to convoluted record syntax

2008-07-03 Thread Dougal Stanton
Hi Haskellers, This is a style question, as my program works fine but looks really ugly and can be confusing to maintain. I take options from the command line using GetOpt and hand back this structure for later use. data Opts = Opts { query :: Query , queryLimit:: Maybe

Re: [Haskell-cafe] Alternatives to convoluted record syntax

2008-07-03 Thread Henning Thielemann
On Thu, 3 Jul 2008, Dougal Stanton wrote: Here's a snippet from the parser for one option (others omitted for clarity): options :: [OptDescr (Opts - Opts)] options = [ Option b [bus] (ReqArg busNum NUM) Bus number , ... ] where busNum n os = let b = (query os) { queryBusNumber

[Haskell-cafe] Re: type classes

2008-07-03 Thread DavidA
Slightly off-topic - but I'm curious to know why you want objects representing the structures as well as the elements - what will they be used for? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Alternatives to convoluted record syntax

2008-07-03 Thread Dougal Stanton
On Thu, Jul 3, 2008 at 11:13 AM, Henning Thielemann [EMAIL PROTECTED] wrote: infix2 :: ((Char, Int), String) infix2 = (('b',7),hallo)$%first^:second^=10 (second^=10) replaces the second member of pair with a value. (^:) applies that change to the outer record (again a pair). ($%)

Re: [Haskell-cafe] Alternatives to convoluted record syntax

2008-07-03 Thread Stuart Cook
On Thu, Jul 3, 2008 at 8:00 PM, Dougal Stanton [EMAIL PROTECTED] wrote: Here's a snippet from the parser for one option (others omitted for clarity): options :: [OptDescr (Opts - Opts)] options = [ Option b [bus] (ReqArg busNum NUM) Bus number , ... ] where busNum n os = let

[Haskell-cafe] ANN: The Disciplined Disciple Compiler - alpha 1.1

2008-07-03 Thread Ben Lippmeier
Hi All, I'm pleased to announce version 1.1 of the Disciplined Disciple Compiler (DDC) Disciple is an explicitly lazy dialect of Haskell which supports: - first class destructive update of arbitrary data. - computational effects without the need for state monads. - type directed field

Re: [Haskell-cafe] Re: type classes

2008-07-03 Thread Cotton Seed
A number of operations -- like order above -- are conceptually connected not to the elements but to the structures themselves. Here is the outline of a more complicated example. I also have a vector space class class VectorSpaceTy a b | a - b where dimension :: a - Integer basis :: (Field

Re: [Haskell-cafe] type classes

2008-07-03 Thread Cotton Seed
Hi Henning, The numeric prelude was inspiration for a lot of my design. Part of the reason I didn't use it was because one of my goals is to learn Haskell better, and I wanted to grapple with these design decisions myself. I decided, like IsZeroTestable in the numeric prelude, to make zero/one

[Haskell-cafe] parallel_map_reduce, in easy one liner mod

2008-07-03 Thread jinjing
Hi haskellers, So.. the type says it all p_map_reduce :: ([a] - b) - (b - b - b) - [a] - b so the idea is to write your computation extensive funciton as a map_reduce function, simplest example: sum ( can be seen as map id then reduce (+) ) then instead of calling: sum xs just call:

Re: [Haskell-cafe] ANN: The Disciplined Disciple Compiler - alpha 1.1

2008-07-03 Thread Robin Green
Is there any work on combining effect typing with extended static checking or full-blown formal verification (e.g. proof-carrying code)? My hunch would be that an impure functional language like this (OCaml is another example) makes optimisation easier, compared to Haskell - but at the expense of

[Haskell-cafe] Type families versus functional dependencies question

2008-07-03 Thread Alexey Rodriguez
Hi guys, We are having trouble with the following program that uses type families: class Blah f a where blah :: a - T f f a class A f where type T f :: (* - *) - * - * the following function does not type: wrapper :: forall a f . Blah f a = a - T f f a wrapper x = blah x GHC gives

Re: [Haskell-cafe] Re: A Monad for on-demand file generation?

2008-07-03 Thread Joachim Breitner
Hi, Am Mittwoch, den 02.07.2008, 16:43 +0100 schrieb ChrisK: hen, the readFileOD could put the timestamp of the read file in a Monad-local state and the writeFileOD could, if the output is newer then all inputs listed in the state, skip the writing and thus the unsafeInterleaveIO’ed file

Re: [Haskell-cafe] Re: A Monad for on-demand file generation?

2008-07-03 Thread Joachim Breitner
Hi, Am Donnerstag, den 03.07.2008, 15:55 +0200 schrieb Joachim Breitner: I have some code that I’ll put somewhere soon. http://darcs.nomeata.de/odio/ODIO.hs now contains a simple implementation of the idea, together with more explanation. To show what the effect is, I wrote a very small

Re: [Haskell-cafe] Type families versus functional dependencies question

2008-07-03 Thread Claus Reinke
GHC gives the error: Couldn't match expected type `T f1 f1 a' against inferred type `T f f a' In the expression: blah x In the definition of `wrapper': wrapper x = blah x actually, GHC gives me could not deduce Blah f a from Blah f1 a first. It seems that desugaring type

[Haskell-cafe] Re: A Monad for on-demand file generation?

2008-07-03 Thread ChrisK
Joachim Breitner wrote: * The 5th line does not have this effect. Because this gets desugared to (), the special implementation of () means that the next line still sees the same dependency state as the before the call to liftIO. You are violating the monad laws. (f k) and (f = \_ - k)

Re: [Haskell-cafe] Re: A Monad for on-demand file generation?

2008-07-03 Thread David Roundy
On Thu, Jul 03, 2008 at 07:09:58PM +0100, ChrisK wrote: Joachim Breitner wrote: * The 5th line does not have this effect. Because this gets desugared to (), the special implementation of () means that the next line still sees the same dependency state as the before the call to liftIO. You

Re: [Haskell-cafe] Type families versus functional dependencies question

2008-07-03 Thread Alexey Rodriguez
On Thu, Jul 3, 2008 at 7:31 PM, Claus Reinke [EMAIL PROTECTED] wrote: GHC gives the error: Couldn't match expected type `T f1 f1 a' against inferred type `T f f a' In the expression: blah x In the definition of `wrapper': wrapper x = blah x actually, GHC gives me could not

Re: [Haskell-cafe] Access to Oracle database from Haskell

2008-07-03 Thread Henning Thielemann
On Mon, 30 Jun 2008, Alistair Bayley wrote: I haven't found a way to detect where headers are installed, so I propose that the Setup.hs assumes $ORACLE_HOME/rdbms/public (for Unix), and you can add more with --extra-include-dirs=... . What do you think? Many thanks for including the

Re: [Haskell-cafe] Type families versus functional dependenciesquestion

2008-07-03 Thread Claus Reinke
actually, GHC gives me could not deduce Blah f a from Blah f1 a first. It seems that desugaring type function notation into an additional constraint helps, so there's something odd going on: Silly me, I didn't paste the whole type error. Yes, GHC gives both. I should add that I tested this

Re: [Haskell-cafe] Re: A Monad for on-demand file generation?

2008-07-03 Thread Joachim Breitner
Hi, Am Donnerstag, den 03.07.2008, 11:35 -0700 schrieb David Roundy: On Thu, Jul 03, 2008 at 07:09:58PM +0100, ChrisK wrote: Joachim Breitner wrote: You are violating the monad laws. (f k) and (f = \_ - k) should do the same thing. You might write a version of liftIO that has the

Re: [Haskell-cafe] Alternatives to convoluted record syntax

2008-07-03 Thread Tim Docker
For access to nested record fields I implemented the record-access package. Unfortunately the field accessors must still be written manually. http://darcs.haskell.org/record-access/src/Data/Accessor/Example.hs I looked for this on hackage, but found instead this:

Re: [Haskell-cafe] Type families versus functional dependencies question

2008-07-03 Thread Manuel M T Chakravarty
Alexey Rodriguez: We are having trouble with the following program that uses type families: class Blah f a where blah :: a - T f f a class A f where type T f :: (* - *) - * - * the following function does not type: wrapper :: forall a f . Blah f a = a - T f f a wrapper x = blah x

[Haskell-cafe] Wouter Swierstra style extensible records!

2008-07-03 Thread Ron Alford
Having made over-use of Wouter's expression idioms, I decided to hack it into extensible records. It's not documented, it's probably got holes in its usability, but I thought I'd post it so people can play with it (and give suggestions before I rewrite my code to use it!). I know there are other