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
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 =
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
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
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
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
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
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
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 ::