I sometimes come across a situation when I only want to provide a
_partial_ type annotation, perhaps because the full type has some
variable unified with some variable in some other type annotation, or
something. For instance:
f :: forall a. [a] -> [a] -> [a]
f x y = g x where
g [] = y
Already in GHC, and describe in our paper on scoped type variables:
http://research.microsoft.com/~simonpj/papers/scoped-tyvar
Simon
| -Original Message-
| From: Ashley Yakeley [mailto:[EMAIL PROTECTED]]
| Sent: 11 April 2002 12:11
| To: Haskell List
| Subject: More Haskell Blue
Ç×°®µÄÅóÓÑ£º
ÄúºÃ£¡
ÕâÊÇÀ´×ÔÈðÀ´ÍøÂç¼¼Êõ£¨ÏÃÃÅ£©ÓÐÏÞ¹«Ë¾µÄÎʺ¸ÐлÄúÊÕ¿´Õâ·âÓʼþ¡£ÎÒÃÇÕæ³ÏµÄÏ£ÍûÄúÄܳÉΪÎÒÃÇÔÚ
¹óµØÇøµÄÖØÒª»ï°é¡£ÎÒÃÇÊÇÒ»¼Ò²ÉÓÃÊÀ½ç¸ßм¼Êõ½á¾§£¬Ñо¿¡¢ÍƹãºÍ·¢Õ¹Ð¼¼Êõ£¬ÖÂÁ¦ÓÚ»¥ÁªÍøÐÅÏ¢·þÎñ¡¢
µç×ÓÉÌÎñ·þÎñºÍÆóÒµÓ¦Ó÷þÎñµÄ¸ßм¼ÊõÆóÒµ¡£ÏêÇéÇëä¯ÀÀ:http://www.raeline.net
ema
I actually have wanted a similar thing at times, the proposal I had in
mind was a bit less drastic, simply allow '_' in type signatures which
will unify with any arbitrary type. that way you can give any function
the type
f :: _ -> _
or if you just want to resstrict part of the type you could say
Somewhere (either Algorithms: AFA, some paper, or the haskell report) I
read that seq evaluates its first argument to head normal form. I
remember posting on this message forum or haskell-cafe that it evaluates
the first argument to weak head normal form. At the time, I thought
I was right, THEN
On Thu, 11 Apr 2002, Jay Cox wrote:
> I still am trying to write a document about strictness and haskell
> evaluation for those of us without research degrees ;-)
Just to say something quick. There are a few of you that actually
responded when I was going to write what I then called "A strictne
Jay Cox wrote:
>
> ...
> so it looks if seq reduced to head normal form, above would be
> reduced to (\x . 2+y)
seq reduces its first argument to weak head normal form, as in:
f = seq (const undefined) "good"
g = seq undefined "bad"
Main> f
"good"
(93 reductions, 148 cells)
Main> g
"
Program e
(Apologies for multiple postings)
IFL 2002
14th International Workshop on the
IMPLEMENTATION OF FUNCTIONAL LANGUAGES
Madrid
Spain