type of 'id'?

7 views
Skip to first unread message

John Nowak

unread,
Apr 26, 2008, 3:51:21 AM4/26/08
to catla...@googlegroups.com
In Cat, 'id' is assigned the type 'a -> a'. I'm curious why it isn't
'A -> A'. In other words, why does 'id' require there be anything on
the stack? I would've assumed the meaning of 'id' to be "returns the
stack unchanged" rather than "returns the top value of the stack
unchanged".

- John

Christopher Diggins

unread,
Apr 26, 2008, 11:03:42 AM4/26/08
to catla...@googlegroups.com
Hi John,

The "id" operation is used just to simplify certain type signatures.
In reality it doesn't vary from the the "noop" operation:

define noop : ('A -> 'A) { }

- Christopher

Reply all
Reply to author
Forward
0 new messages