Sorry wrong paste
Yes, same problem, and again I have no idea how to read the typePrelude> :t max. 3 2max. 3 2 :: (Ord b, Num a1, Num (a1 -> a -> b)) => a -> b -> bWhat does the type mean in plain english?DaryoushOn Thu, Nov 15, 2012 at 11:56 PM, Ramana Kumar <Ramana.Kumar@cl.cam.ac.uk> wrote:
Another experiment may be revealing:
:t 3 2
On Fri, Nov 16, 2012 at 7:46 AM, Daryoush Mehrtash <dmehrtash@gmail.com> wrote:
I see the point with :t (.) thatmax.(+1) 2 2is the same as
max. 3 2Which is not what I want.But I have no idea what the type signature of this expression mean nowPrelude> :t max. 3 2max. 3 2 :: (Ord b, Num a1, Num (a1 -> a -> b)) => a -> b -> bAny idea?DaryoushOn Thu, Nov 15, 2012 at 11:19 PM, Ramana Kumar <Ramana.Kumar@cl.cam.ac.uk> wrote:Hi Daryoush,
I recommend you try these experiments first, and then reply back if you're still confused.
:t max
:t (+1)
:t max . (+1)
:t (+1) 2
:t (.)On Fri, Nov 16, 2012 at 7:10 AM, Daryoush Mehrtash <dmehrtash@gmail.com> wrote:
_______________________________________________I am having hard time understanding how removing the outer parenthesis in(max.(+1)) 2 2tomax.(+1) 2 2changes the meaning of expression.My expectation was that "max.(+1) takes two numbers and returns the max as defined in the type::t max.(+1)max.(+1) :: (Ord b, Num b) => b -> b -> bWith parenthesis it does what I expect it to:Prelude> :t (max.(+1)) 2 2(max.(+1)) 2 2 :: (Ord b, Num b) => bPrelude> (max.(+1)) 2 23But if I remove the parenthesis I get a beast that I have no idea what its type signature mean any morePrelude> :t (max.(+1)) 2 2(max.(+1)) 2 2 :: (Ord b, Num b) => bPrelude> :t max.(+1) 2 2max.(+1) 2 2 :: (Ord b, Num a1, Num (a1 -> a -> b)) => a -> b -> bHow did removal of parenthesis changed the meaning? How do you interpret the type: "(Ord b, Num a1, Num (a1 -> a -> b)) => a -> b -> b"?Thanks--
Daryoush
Weblog: http://onfp.blogspot.com/
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
--
Daryoush
Weblog: http://onfp.blogspot.com/
--
Daryoush
Weblog: http://onfp.blogspot.com/