[Haskell-cafe] expected vs inferred type confusion

2008-06-23 Thread Stephen Howard
I am having issues with type signatures for the resourceHandler action below. I haven't figured out what I'm doing wrong to cause the wrong type to be returned. It looks like Haskell is inferring that I'm returning a function from this action, when from the type signature I've specified, that

Re: [Haskell-cafe] type constructor confusion

2008-06-19 Thread Stephen Howard
-- type HttpMessage = Either HttpRequest HttpResponse Now you can have functions that take/return just an HttpRequest or just an HttpResponse, as well as functions that use either one via HttpMessage. In the latter case, you do need to pattern match to decide which one you have. -- ryan On 6/1

Re: [Haskell-cafe] type constructor confusion

2008-06-18 Thread Stephen Howard
ow I should be specifying that. Ideas? - Stephen Brandon S. Allbery KF8NH wrote: On Jun 18, 2008, at 15:31 , Stephen Howard wrote: HttpMessage.hs:36:20: Not in scope: type constructor or class `HttpRequest' The troublesome line is the definition of the cookie function at the end o

Re: [Haskell-cafe] Re: working with Random.randoms

2008-06-18 Thread Stephen Howard
seemed to do more harm than good when it came to legibility. - Stephen Jon Fairbairn wrote: Stephen Howard <[EMAIL PROTECTED]> writes: I am a newcomer doing my obligatory struggling with Haskell's type system, That's your mistake. Don't struggle with the type sys

[Haskell-cafe] type constructor confusion

2008-06-18 Thread Stephen Howard
hello list, loading the code below into ghci gives me this error: HttpMessage.hs:36:20: Not in scope: type constructor or class `HttpRequest' The troublesome line is the definition of the cookie function at the end of the code. I've made HttpRequest and HttpResponse constructors of HttpMessa

[Haskell-cafe] working with Random.randoms

2008-06-13 Thread Stephen Howard
Hi List, I am a newcomer doing my obligatory struggling with Haskell's type system, and I've got a nut I've not been able to crack. Given: import Random random_test :: Int -> String random_test n = do g <- getStdGen take n (randoms g)::String I'm expecting that I ought to be able to p