weird (bug?) in linear implicit parameters

Hal Daume III hdaume@ISI.EDU
Tue, 23 Jul 2002 10:56:24 -0700 (PDT)


(guess who finally decided to learn about imp params :P)

this looks like a bug to me, but of course i may be wrong.

consider these definitions:

> data BLSupply = BLSupply [Bool]
> 
> instance Splittable BLSupply where
>     split (BLSupply l) = (BLSupply (True:l), BLSupply (False:l))
>
> newBL (BLSupply bl) = bl

basically we can name things by lists of bools

we name lists using this function:

> number :: (%ns :: BLSupply) => [a] -> [(a,[Bool])]
> number [] = []
> number (x:xs) = (x,n) : number xs
>     where n = newBL %ns

which works fine.  in ghci:

*ImpParam> let %ns = BLSupply [] in number "hello"
[('h',[False]),('e',[False,True]),('l',[False,True,True]),('l',[False,True,True,True]),('o',[False,True,True,True,True])]

Whee.  now here's the wierd thing.  suppose we remove the type signature
from the number function.  then, in ghci:

*ImpParam> :t number
forall a. (%ns :: BLSupply) => [a] -> [(a, [Bool])]
*ImpParam> let %ns = BLSupply [] in number "hello"
[('h',[]),('e',[]),('l',[]),('l',[]),('o',[])]

what gives?  why did it suddenly break even though it gets the type right?

 - hal

--
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume