Re: [Haskell-cafe] How do I do conditional tail recursion in a monad?

2007-03-22 Thread Juan Carlos Arevalo Baeza
I suppose there are plenty of flavors for such functions, and they are simple enough to write. One I've been using a bit is this one: loopM :: Monad m = a - (a - m (Maybe a)) - m () loopM start action = loop start where loop i = do result - action i case

Re: [Haskell-cafe] Re: Matrices in Haskell

2007-03-22 Thread Ivan Lazar Miljenovic
Sorry for the double post before... must have hit send without noticing :s (it would also help if I posted this to the mailing list instead of just to myself!). Anyway, I had a thought today: what about using a quadruply linked list? i.e.: data QLNode a = Null | QLNode a (Right a) (Up a) (Left

[Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Arun Suresh
Hi.. I am currently working on a project where basically we do a lot of XML validation and digestion. For example : We recieve an XML document A, if the document passes schema validation, we do some business level validations, then from A, we create XML digests B, C and D. Our code-base is

Re: [Hs-Generics] FW: [Haskell-cafe] SYB vs HList (again)

2007-03-22 Thread S. Alexander Jacobson
Not sure the proposal helps me with my other issues. The appealing thing about hlists is that labels are first class which means obvious ways of parsing URLEncoded Strings and obvious ways to render them in XML. In particular HLists are actually a different type from positional data

Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Duncan Coutts
On Thu, 2007-03-22 at 14:04 +0530, Arun Suresh wrote: I am currently working on a project where basically we do a lot of XML validation and digestion. For example : We recieve an XML document A, if the document passes schema validation, we do some business level validations, then from A, we

[Haskell-cafe] Re: Matrices in Haskell

2007-03-22 Thread apfelmus
Ivan Lazar Miljenovic wrote: Anyway, I had a thought today: what about using a quadruply linked list? i.e.: data QLNode a = Null | QLNode a (Right a) (Up a) (Left a) (Bottom a) where Right, Up, Left and Bottom are just type synonyms of QLNode. You

Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Andrew Wagner
Hi Arun, Your problem description seems a little vague - which is understandable, considering how embedded in your business model it is. As for general recommendations, I'm no guru, but I would suggest looking at the existing XML libraries in Haskell [1], and if that's not powerful enough, check

[Haskell-cafe] Newbie: Is‘type’ synonym h iding two much?

2007-03-22 Thread Dmitri O.Kondratiev
I am learning Haskell working through Simon Thompson book Haskell The Craft of Functional Programming (second edition). Solving problems in the book with more or less success I arrived almost to the end of the book at the section 17.5 Case study: parsing expressions. Most probably the question I

Re: [Haskell-cafe] Newbie: Is ‘type’ synonym hiding two much?

2007-03-22 Thread Antti-Juhani Kaijanaho
On Thu, Mar 22, 2007 at 06:13:00PM +0300, Dmitri O.Kondratiev wrote: F :: a - b - c Is the same as: F :: a - (b - c) Correcting the typo (use f, not F), these mean the same thing. And means either: -a function 'f' of one argument of type 'a' that returns a function of type (b -

Re: [Haskell-cafe] Newbie: Is ‘type’ synonym hiding two much?

2007-03-22 Thread Ian Lynagh
On Thu, Mar 22, 2007 at 06:13:00PM +0300, Dmitri O.Kondratiev wrote: succeed :: b - Parse a b *Before looking at 'succeed' function definition* one may think that 'succeed' is a function of *one* argument of type 'b' that returns object of type 'Parse a b'. Yet, function definition

RE: [Haskell-cafe] Newbie: Is'type' synonym hiding two much?

2007-03-22 Thread Bernie Pope
Dmitri writes: Now, in the 17.5 section of a book one may see the following declarations: succeed :: b - Parse a b *Before looking at 'succeed' function definition* one may think that 'succeed' is a function of *one* argument of type 'b' that returns object of type 'Parse a b'. Yet,

Re: [Haskell-cafe] Newbie: Is 'type' synonym hiding two much?

2007-03-22 Thread Dmitri O.Kondratiev
Now, in the 17.5 section of a book one may see the following declarations: succeed :: b - Parse a b *Before looking at 'succeed' function definition* one may think that 'succeed' is a function of *one* argument of type 'b' that returns object of type 'Parse a b'. Antti-Juhani Kaijanaho

[Haskell-cafe] type refinement to a typeclass constrained type

2007-03-22 Thread Daniil Elovkov
Hello folks A section on GADTs in the GHC user's guide gives a simple example: data Term a where Lit:: Int - Term Int Succ :: Term Int - Term Int IsZero :: Term Int - Term Bool eval :: Term a - a eval (Lit i) = i eval (Succ t) = 1 + eval t eval (IsZero t) =

RE: [Haskell-cafe] type refinement to a typeclass constrained type

2007-03-22 Thread Simon Peyton-Jones
Try the HEAD. GADTs + type classes are broken in 6.6., and will stay that way I'm afraid. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daniil | Elovkov | Sent: 22 March 2007 17:12 | To: haskell-cafe@haskell.org | Subject: [Haskell-cafe]

[Haskell-cafe] random number generators

2007-03-22 Thread david karapetyan
hi, i have been trying to learn haskell and i would like to translate the following object-oriented pseudo-code into working haskell code but i'm stumped on how to write the next function in the haskell code. any help is appreciated. class Random ... end ran = Random.new(300) ran.next() - this

[Haskell-cafe] Duplicate instance declaration

2007-03-22 Thread Bas van Dijk
Hello, I'm making an assembly language DSEL in Haskell (just for fun) very similar to the one from Russel O' Conner in [1] I'm trying to specify a 'mov' instruction. A 'mov' instruction has two operands: a destination and a source. There are various constraints on the operands. They have to be

Re: [Haskell-cafe] random number generators

2007-03-22 Thread Paul Johnson
david karapetyan wrote: hi, i have been trying to learn haskell and i would like to translate the following object-oriented pseudo-code into working haskell code but i'm stumped on how to write the next function in the haskell code. any help is appreciated. class Random ... end ran =

Re: [Haskell-cafe] Duplicate instance declaration

2007-03-22 Thread Twan van Laarhoven
Bas van Dijk wrote: I would also like to get the formatting constraints working. However the solution in the code below gives a Duplicate instance declarations error. If I -fallow-overlapping-instances than the type checker goes into an infinite loop. I would like to know why this is

Re: [Haskell-cafe] type refinement to a typeclass constrained type

2007-03-22 Thread Daniil Elovkov
Ok, thank you very much. Interesting thing though, it's the same on 6.4.1. Wasn't this brokenness introduced in 6.6, but rather has lingered in ghc for a while, or since the introduction of GADTs, at all? 2007/3/22, Simon Peyton-Jones [EMAIL PROTECTED]: Try the HEAD. GADTs + type classes are

[Haskell-cafe] ghc warning Var/Type length mismatch

2007-03-22 Thread Nicolas Frisby
When I load my program, GHC spits these messages at me, but doesn't fail Any idea what might be causing this or how to figure that out? Var/Type length mismatch: [] [a{tv aGIf} [tau]] ... Var/Type length mismatch: [] [a{tv aGN8} [tv]] ... I found the responsible code in GHC's darcs,

Re: [Haskell-cafe] ghc warning Var/Type length mismatch

2007-03-22 Thread Tim Chevalier
On 3/22/07, Nicolas Frisby [EMAIL PROTECTED] wrote: When I load my program, GHC spits these messages at me, but doesn't fail Any idea what might be causing this or how to figure that out? Var/Type length mismatch: [] [a{tv aGIf} [tau]] ... Var/Type length mismatch: [] [a{tv

Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Chris Eidhof
Don't spend too much time on the various libraries though. I tried some simple things with Haskell and XML, but I found it really hard to actually parse a simple document. You really don't want to write your own parser. The only tool that worked for me was HXT, which is based on arrows.

Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Chris Eidhof
Hey Aron, I think you intended to CC Haskell Café as well. HaXml has support for DtdToHaskell, but HXT supports validating with a Relax NG validator. I guess the best way to figure it out is thoroughly read the documentation. -chris On Mar 22, 2007, at 10:40 PM, Arun Suresh wrote:

[Haskell-cafe] problem in installing hat

2007-03-22 Thread Vikrant
[EMAIL PROTECTED]Hi, I wanted to try out hat debugger. I tried to install it according to instructions. I downloaded the source tgz and did following sequence of operations tar -xvzf hat-2.05.tar.gz cd hat-2.05 ./configure make it gives me following error! MkProg: hmake: the compiler 'ghc'