[Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-09 Thread Andrea Rossato
Hello! probably it's me, but I cannot understand what I'm doing wrong. I'm trying to learn HaXml. I've never used it before and I never did xml processing in Haskell. So I'm a total newbie!! I downloaded and compiled. Everything seems fine. I'm also able to run some examples in the related

Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-09 Thread Andrea Rossato
Il Sat, Sep 09, 2006 at 09:58:03AM -0700, Jason Dagit ebbe a scrivere: Maybe ...use -package HaXml interactively with GHCi... (That's from the HaXml website.) I'm using -package HaXml, obviously, otherwise the module would not load. What I do not understand is that unresolved symbol message: I

Re: [Haskell-cafe] state and exception or types again...

2006-09-02 Thread Andrea Rossato
Il Fri, Sep 01, 2006 at 10:43:14AM +0400, Bulat Ziganshin ebbe a scrivere: imho, your tutorial makes the error that is a very typical: when you write your tutorial you already know what are monads and what the program you will construct at the end. but your reader don't know all these! Ok, so

Re: [Haskell-cafe] Re: Re: A free monad theorem?

2006-09-02 Thread Andrea Rossato
Il Sun, Sep 03, 2006 at 12:26:25AM +0200, Tomasz Zielonka ebbe a scrivere: On Sat, Sep 02, 2006 at 09:51:26PM +0200, Benjamin Franksen wrote: However, in order to 'run' (i.e. finally actually use) a monadic value that involves an application of bind, the latter would have to supply some

Re: [Haskell-cafe] Re: A free monad theorem?

2006-09-01 Thread Andrea Rossato
Il Fri, Sep 01, 2006 at 07:22:02AM +0200, Tomasz Zielonka ebbe a scrivere: On Fri, Sep 01, 2006 at 01:13:14AM +0200, Benjamin Franksen wrote: So getting the value out of the monad is not a pure function (extract :: Monad m = m a - a). I think I stated that, already, in my previous post.

Re: [Haskell-cafe] state and exception or types again...

2006-09-01 Thread Andrea Rossato
Il Fri, Sep 01, 2006 at 10:43:14AM +0400, Bulat Ziganshin ebbe a scrivere: The tutorial will have this outline: first we build a monad adding output, exception, and state. Then we use monad transformer to take out state and output and add debug, doing lifting, put(ing) and get(ing) by

Re: [Haskell-cafe] state and exception or types again...

2006-08-31 Thread Andrea Rossato
Il Wed, Aug 30, 2006 at 11:24:45AM +0100, Brian Hulley ebbe a scrivere: Thanks, glad to be of help. I met Haskell a couple of months ago, when I switched my window manager to Ion. Tuomo Valkonen, its developer, uses darcs. Moreover he develops a small PIM, riot, written in Haskell. I wanted to

Re: [Haskell-cafe] monads once again: a newbie perspective

2006-08-31 Thread Andrea Rossato
Il Thu, Aug 31, 2006 at 02:39:59PM +0100, Simon Peyton-Jones ebbe a scrivere: Andrea Don't forget to link to it from here! http://haskell.org/haskellwiki/Books_and_tutorials#Using_monads Simon, I'll do. But now the text is far from being complete: there's only the code... (the most

Re: [Haskell-cafe] A free monad theorem?

2006-08-31 Thread Andrea Rossato
Il Thu, Aug 31, 2006 at 07:23:55PM +0200, Benjamin Franksen ebbe a scrivere: I argued that monadic values get 'chained' in a very specific way and that in order to get an intuition about what this monadic chaining really means on the most general level, the standard model of 'computation that

Re: [Haskell-cafe] state and exception or types again...

2006-08-30 Thread Andrea Rossato
Il Tue, Aug 29, 2006 at 10:02:38AM +0100, Brian Hulley ebbe a scrivere: Hi! Ím getting back so late because it took me a while to understand monadic transformation... data Result a = Good a State Output | Bad State Output deriving Show ... case runSOIE m x of

Re: [Haskell-cafe] state and exception or types again...

2006-08-29 Thread Andrea Rossato
Il Tue, Aug 29, 2006 at 07:45:46AM +0100, Brian Hulley ebbe a scrivere: Andrea Rossato wrote: Il Mon, Aug 28, 2006 at 09:28:02PM +0100, Brian Hulley ebbe a scrivere: where the 4th element of the tuple is True iff we can continue or False iff an exception occurred. I'm starting to believe

Re: [Haskell-cafe] state and exception or types again...

2006-08-29 Thread Andrea Rossato
Il Tue, Aug 29, 2006 at 10:02:38AM +0100, Brian Hulley ebbe a scrivere: Yes I agree the StateT/monad transformer approach is probably best in the long run, since by using the standard monad transformers, you will get code that will scale better to handle more complexities later, and has the

[Haskell-cafe] state and exception or types again...

2006-08-28 Thread Andrea Rossato
Hello! Sorry if I keep bothering, but I'm still trying to understand types and monads. Now I'm trying to create a statefull evaluator, with output and exception, but I'm facing a problem I seem not to be able to conceptually solve. Take the code below. Now, in order to get it run (and try to

Re: [Haskell-cafe] state and exception or types again...

2006-08-28 Thread Andrea Rossato
Il Mon, Aug 28, 2006 at 08:23:15PM +0200, Andrea Rossato ebbe a scrivere: The previous code was not complete, and so testable. at the end there is the output. there it is: module Monads where data Term = Con Int | Add Term Term deriving (Show) type State = Int type Output

Re: [Haskell-cafe] state and exception or types again...

2006-08-28 Thread Andrea Rossato
Il Mon, Aug 28, 2006 at 09:28:02PM +0100, Brian Hulley ebbe a scrivere: data Eval_SOI a = SOIE {runSOIE :: State - (a, State, Output, Bool)} seems simple and neat... else r1 ie if runSOIE m x does not result in an exception then we continue with the second computation otherwise

Re: [Haskell-cafe] state and exception or types again...

2006-08-28 Thread Andrea Rossato
Il Mon, Aug 28, 2006 at 09:28:02PM +0100, Brian Hulley ebbe a scrivere: where the 4th element of the tuple is True iff we can continue or False iff an exception occurred. I'm starting to believe that the best method is just take the way StateT takes... without reinventing the wheel...

Re: [Haskell-cafe] difference between type and newtype

2006-08-26 Thread Andrea Rossato
Il Sat, Aug 26, 2006 at 02:02:36AM +0200, Andrea Rossato ebbe a scrivere: perhaps this is silly, but it is not possible to declare function types? could you please indicate me some documentation that explains this kind of stuff? So far I didn't find anything on that. well, I've found

Re: [Haskell-cafe] difference between type and newtype

2006-08-26 Thread Andrea Rossato
Il Sat, Aug 26, 2006 at 11:55:34AM +0100, Brian Hulley ebbe a scrivere: Yes, it's useful because it allows you to make a distinction between different uses of the same type of function and make these different uses into instances of different classes. It also allows you to hide the fact

Re: [Haskell-cafe] difference between type and newtype

2006-08-26 Thread Andrea Rossato
Il Sat, Aug 26, 2006 at 06:00:02PM +0400, Bulat Ziganshin ebbe a scrivere: type HashFunction = (String-Int) ... createHash :: HashFunction - IO Hash and createHash :: (String-Int) - IO Hash are equivalent. So, technically speaking, you can't declare function types, there is only one

Re: [Haskell-cafe] monads once again: a newbie perspective

2006-08-26 Thread Andrea Rossato
Il Fri, Aug 25, 2006 at 01:13:58PM -0400, Cale Gibbard ebbe a scrivere: Hey cool, a new monad tutorial! :) Just out of interest, have you seen my Monads as Containers article? http://www.haskell.org/haskellwiki/Monads_as_Containers Let me know what you think of it. I find that often

Re: [Haskell-cafe] monads once again: a newbie perspective

2006-08-25 Thread Andrea Rossato
Il Thu, Aug 24, 2006 at 08:02:38PM +0100, Neil Mitchell ebbe a scrivere: Just shove it on the wiki regardless. If its useless then no one will read it. If its a bit unreadable, then people will fix it. If its useful the world will benefit. Any outcome is a good outcome! Ok: I've put it on the

[Haskell-cafe] difference between type and newtype

2006-08-25 Thread Andrea Rossato
Hello! I cannot understand this piece of code: type Z = Int type T a = Z - (a, Z)

Re: [Haskell-cafe] difference between type and newtype

2006-08-25 Thread Andrea Rossato
Il Fri, Aug 25, 2006 at 07:52:35PM +0100, Neil Mitchell ebbe a scrivere: why mkT is a type constructor and mkT1 seems not to be? In what way is mkT a type constructor? In this program only T1 is a type constructor, as far as I can see. read my sentence as why T is a type constructor and T1

Re: [Haskell-cafe] difference between type and newtype

2006-08-25 Thread Andrea Rossato
Il Fri, Aug 25, 2006 at 08:35:01PM +0100, Brian Hulley ebbe a scrivere: It is maybe easier to just think of a newtype decl as being the same as a data decl except for the fact that you can only have one constructor on the rhs whereas a data decl allows multiple constructors, and a type decl

Re: [Haskell-cafe] difference between type and newtype

2006-08-25 Thread Andrea Rossato
Il Sat, Aug 26, 2006 at 01:27:38AM +0200, Daniel Fischer ebbe a scrivere: Because T a is a function type, namely Int - (a,Int), so ... iHowever, neither T1 a nor T2 a is a function type, a value of type T1 a is a function _wrapped by the data (or value) constructor T1_ (the same applies to

Re: [Haskell-cafe] difference between type and newtype

2006-08-25 Thread Andrea Rossato
Il Sat, Aug 26, 2006 at 01:27:38AM +0200, Daniel Fischer ebbe a scrivere: unT1 :: T1 a - T a unT1 (T1 f) = f makeT1 a b = unT1 (mkT1 a) b will work fine. *Prelude :t makeT1 makeT1 :: a - Int - (a, Int) *Prelude not that fine, though. Quite useless. try chancing to: unT1 :: T1 a - T1

[Haskell-cafe] monads once again: a newbie perspective

2006-08-24 Thread Andrea Rossato
` mkMO a evalMO (Add t u) = evalMO t `bindMO` \a - evalMO u `bindMO` \b - outMO (formatLine (Add t u) (a + b)) `combineMO` mkMO (a + b) That's it. For today... (TO BE CONTINUED) Andrea Rossato arossato

<    1   2