[Haskell-cafe] Polymorphic Type Safe URL building -- I need advice on my project

2012-11-16 Thread Kyle Hanson
Hello, So I started working on a project involving polymorphic type safe urls. I know there are other type-safe url's out there, but I want some advice before I start reorganizing it. It is located here: https://github.com/dracule/web-scatter One might ask why you would want polymorphic types

[Haskell-cafe] Polymorphic type

2006-06-22 Thread Sara Kenedy
Hello all, Now I am trying with the function of polymorphic type: This function returns the Nth element of list with type a. I try it as below. getNthElem :: Int - [a] - Maybe a getNthElemt _ []= Nothing getNthElem 0 _ = Nothing getNthElem n s | n length s =

Re: [Haskell-cafe] Polymorphic type

2006-06-22 Thread Jared Updike
On 6/22/06, Sara Kenedy [EMAIL PROTECTED] wrote: Hello all, Now I am trying with the function of polymorphic type: This function returns the Nth element of list with type a. I try it as below. getNthElem :: Int - [a] - Maybe a getNthElemt _ []= Nothing getNthElem 0 _ = Nothing

Re: [Haskell-cafe] Polymorphic type

2006-06-22 Thread minh thu
2006/6/22, Sara Kenedy [EMAIL PROTECTED]: Hello all, Now I am trying with the function of polymorphic type: This function returns the Nth element of list with type a. I try it as below. getNthElem :: Int - [a] - Maybe a getNthElemt _ []= Nothing getNthElem 0 _ = Nothing getNthElem n s

Re: [Haskell-cafe] Polymorphic type

2006-06-22 Thread Brian Hulley
Sara Kenedy wrote: Hello all, Now I am trying with the function of polymorphic type: This function returns the Nth element of list with type a. I try it as below. getNthElem :: Int - [a] - Maybe a getNthElemt _ [] = Nothing getNthElem 0 _ = Nothing getNthElem n s n length s = Nothing

Re: [Haskell-cafe] Polymorphic type

2006-06-22 Thread Sara Kenedy
Thanks all. I think for my function, I only need to throw an error message for the out of range index. But through this, I know more some ways to deal with the polymorphic type. On 6/22/06, Brian Hulley [EMAIL PROTECTED] wrote: Sara Kenedy wrote: Hello all, Now I am trying with the function

[Haskell-cafe] polymorphic type

2005-07-06 Thread wenduan
Dear all, Suppose we have defined two functions as below: case :: (a - c,b - c) - Either a b - c case (f, g) (Left x) = f x case (f, g) (Right x) = g x plus :: (a - b, c - d) - Either a b - Either c d plus (f, g) = case(Left.f, Right.g) My question is regarding to the function signature of

Re: [Haskell-cafe] polymorphic type

2005-07-06 Thread Stefan Holdermans
Wenduan, What I thought at first the signature of plus should be: plus :: (a - c, b - d) - Either a b - Either c d?Anyone know where I was wrong? Your initial thought was right: it should (a - c, b - d) - Either a b - Either c d Why didn't you just test it by feeding in to a compiler or

Re: [Haskell-cafe] polymorphic type

2005-07-06 Thread Henning Thielemann
On Wed, 6 Jul 2005, wenduan wrote: Dear all, Suppose we have defined two functions as below: case :: (a - c,b - c) - Either a b - c case (f, g) (Left x) = f x case (f, g) (Right x) = g x It seems to be case == uncurry either Prelude :info either -- either is a variable either ::