Re: [Haskell-cafe] Checking a value against a passed-in constructor?

2009-06-02 Thread Dan
Hi Richard, Yeek. Why do you want to do _that_? Heh. I've got a parser and I want to check what I've parsed (it's an exercise in Write Yourself a Scheme in 48 Hours). check (Atom _) (Atom _) = True check (Bool _) (Bool _) = True check __= False Yes I

Re: [Haskell-cafe] Checking a value against a passed-in constructor?

2009-06-02 Thread Ryan Ingram
On Tue, Jun 2, 2009 at 3:50 AM, Dan danielkc...@gmail.com wrote: You hit the nail on the head.  Why I am doing this is because of boilerplate. Boilerplate gives me rashes and bulbous spots on the nose. Consider the following Ruby code:        def check(zeClass, zeValue)                

Re: [Haskell-cafe] Checking a value against a passed-in constructor?

2009-06-02 Thread wren ng thornton
Ryan Ingram wrote: Dan danielkc...@gmail.com wrote: I figured there would be a clever Haskell idiom that would give me a similarly concise route. Does it really require Template Haskell? I can barely parse regular Haskell as it is.. [...] Alternatively, you can define a fold[1] once:

[Haskell-cafe] Checking a value against a passed-in constructor?

2009-06-01 Thread Dan Cook
Hi, (Relatively new to Haskell here ..) So I have the following: data MyVal = Atom String | Bool Bool And I want to do something like this check :: (Bool - MyVal) - MyVal - True check f (f x) = True check _ _ = False What that means is I want to pass a MyVal

Re: [Haskell-cafe] Checking a value against a passed-in constructor?

2009-06-01 Thread Jason Dagit
Hi Dan, On Mon, Jun 1, 2009 at 8:39 PM, Dan Cook danielkc...@gmail.com wrote: Hi, (Relatively new to Haskell here ..) So I have the following: data MyVal = Atom String | Bool Bool And I want to do something like this check :: (Bool - MyVal) - MyVal - True

Re: [Haskell-cafe] Checking a value against a passed-in constructor?

2009-06-01 Thread Richard O'Keefe
On 2 Jun 2009, at 3:39 pm, Dan Cook wrote: Hi, (Relatively new to Haskell here ..) So I have the following: data MyVal = Atom String | Bool Bool And I want to do something like this check :: (Bool - MyVal) - MyVal - True check f (f x) = True check _ _ = False What