Discussion:
Miranda - built-in "show" function
(too old to reply)
duke
2012-07-01 01:01:12 UTC
Permalink
I'm trying to get the following code to work in the latest version of Miranda:

[code]good_timestamp (time, msg) = msg ++ " at " ++ (show time) ++ "o'clock"[/code]

I keep getting this error:

[quote]No modified files, so no updates needed.
compiling script.m
checking types in script.m
type error in definition of good_timestamp
(line 9 of "script.m") use of "show" at polymorphic type *[/quote]

The code is taken from "Programming with Miranda", so it should work, I'm thinking. :) At first, I was thinking it was my "offside rule" formatting that was off, but it doesn't seem to matter. Ideas please!
Vincent Zweije
2012-07-01 09:44:06 UTC
Permalink
In article <c262d958-f919-469e-8a48-***@googlegroups.com>,
duke <***@gmail.com> wrote:

|| I'm trying to get the following code to work in the latest version of
|| Miranda:
||
|| [code]good_timestamp (time, msg) = msg ++ " at " ++ (show time) ++ "o'clock"[/code]
||
|| I keep getting this error:
||
|| [quote]No modified files, so no updates needed.
|| compiling script.m
|| checking types in script.m
|| type error in definition of good_timestamp
|| (line 9 of "script.m") use of "show" at polymorphic type *[/quote]

Miranda's show operator is not a polymorphic function, but a "family
of monomorphic" ones. Its type is not (* -> [char]) but (X -> [char])
for any monomorphic type X. See the documentation.

Declare the type of good_timestamp so that at least the type of time
becomes fully known.

Ciao. Vincent.
--
Vincent Zweije <***@zweije.nl> | "If you're flamed in a group you
<http://www.xs4all.nl/~zweije/> | don't read, does anybody get burnt?"
[Xhost should be taken out and shot] | -- Paul Tomblin on a.s.r.
duke
2012-07-01 11:02:04 UTC
Permalink
On Sunday, July 1, 2012 3:44:06 AM UTC-6, Vincent Zweije wrote:

[snip]
Post by Vincent Zweije
Miranda's show operator is not a polymorphic function, but a "family
of monomorphic" ones. Its type is not (* -> [char]) but (X -> [char])
for any monomorphic type X. See the documentation.
Declare the type of good_timestamp so that at least the type of time
becomes fully known.
Thanks! I thought that the example would run - as is. I see that I have more reading to do - monomorphic vs polymorphic!
Loading...