Re[2]: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-09 Thread Bulat Ziganshin
Hello Shannon, Thursday, March 9, 2006, 1:19:39 AM, you wrote: >> I'd use a State-monad, say SjB> I suspect you guys are right. I had always thought of states as SjB> being "isomorphic" to integers (i.e. you can be in state 0, state 1, SjB> ... state n), not as contexts (you have this input, th

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-09 Thread Jared Updike
> Dude, that was a friggin' awesome email! I'm trying to figure out how > I can just copy it wholesale into the article ;) Use what you need. Share and share alike. > I've been struggling > with Haskell for long enough that my knowledge is now snowballing > downhill. I think I experienced that

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-08 Thread Shannon -jj Behrens
On 3/8/06, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote: > On 3/8/06, Jared Updike <[EMAIL PROTECTED]> wrote: > > > I suspect you guys are right. I had always thought of states as > > > being "isomorphic" to integers (i.e. you can be in state 0, state 1, > > > ... state n), not as contexts (you h

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-08 Thread Shannon -jj Behrens
On 3/8/06, Jared Updike <[EMAIL PROTECTED]> wrote: > > I suspect you guys are right. I had always thought of states as > > being "isomorphic" to integers (i.e. you can be in state 0, state 1, > > ... state n), not as contexts (you have this input, that output, and > > this token stack), am I wrong

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-08 Thread Jared Updike
> I suspect you guys are right. I had always thought of states as > being "isomorphic" to integers (i.e. you can be in state 0, state 1, > ... state n), not as contexts (you have this input, that output, and > this token stack), am I wrong? You're thinking of a state machine, I think, which is no

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-08 Thread Shannon -jj Behrens
First of all, thank you all so much for taking the time to help me with this exercise! My hope is that once I'm able to understand it, my understanding can come through in the article I write. > Brian Hulley: > In the pipe in the 'otherwise' branch, at the moment you have to > assume that each of

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-08 Thread Daniel Fischer
Am Dienstag, 7. März 2006 20:52 schrieb Shannon -jj Behrens: > I did think of using a monad, but being relatively new to Haskell, I > was confused about a few things. Let's start by looking at one of my > simpler functions: > > -- Keep pushing tokens until we hit an identifier. > pushUntilIdentifi

Re[2]: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-08 Thread Bulat Ziganshin
Hello Shannon, Tuesday, March 7, 2006, 10:52:01 PM, you wrote: SjB> The function itself is a ParseContextTransformation. It takes a SjB> context, transforms it, and returns it. Most of the pipelines in the SjB> whole application are ParseContextTransformations, and the |> (or $ or SjB> .) are w

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-07 Thread Brian Hulley
Shannon -jj Behrens wrote: I did think of using a monad, but being relatively new to Haskell, I was confused about a few things. Let's start by looking at one of my simpler functions: -- Keep pushing tokens until we hit an identifier. pushUntilIdentifier :: ParseContextTransformation pushUntilI

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-07 Thread Shannon -jj Behrens
I did think of using a monad, but being relatively new to Haskell, I was confused about a few things. Let's start by looking at one of my simpler functions: -- Keep pushing tokens until we hit an identifier. pushUntilIdentifier :: ParseContextTransformation pushUntilIdentifier ctx | currTokType

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-07 Thread Brian Hulley
Brian Hulley wrote: translate :: (Monad m) => String -> m String translate = do createParseContext readToFirstIdentifier dealWithDeclarator consolidateOutput The type signature above doesn't match the do blo

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-06 Thread Bill Wood
On Mon, 2006-03-06 at 11:25 -0800, Shannon -jj Behrens wrote: . . . > I find "ctx |> currTok |> tokenType" to be more readable than > "tokenType $ currTok $ ctx" because you're not reading the code in > reverse. That's my primary complaint with "." and "$". That's > especially the case when I'

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-06 Thread Udo Stenzel
Shannon -jj Behrens wrote: > I find "ctx |> currTok |> tokenType" to be more readable than > "tokenType $ currTok $ ctx" because you're not reading the code in > reverse. That's my primary complaint with "." and "$". Seconded. That's why I'd like to see the arguments to (.) swapped, but it's too

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-06 Thread Brian Hulley
Shannon -jj Behrens wrote: I find "ctx |> currTok |> tokenType" to be more readable than "tokenType $ currTok $ ctx" because you're not reading the code in reverse. That's my primary complaint with "." and "$". That's especially the case when I'm spreading the code over multiple lines: -- Tran

Re: [Haskell-cafe] |> vs. $ (was: request for code review)

2006-03-06 Thread Shannon -jj Behrens
By the way, thanks for everyone's comments so far! They're very helpful! > Also, most haskell programs use $ instead of |> > > > -- For convenience: > > currTokType :: ParseContext -> TokenType > > currTokType ctx = ctx |> currTok |> tokenType > > this could be written as: > tokenType $ currTok $