[Haskell-beginners] "stage restriction" when using Data.Heap
Twan van Laarhoven
twanvl at gmail.com
Tue Jan 8 11:22:40 CET 2013
On 08/01/13 07:03, Martin Drautzburg wrote:
> import Data.Heap
>
> heap = empty :: MinHeap (Int,String)
> insert (1,"kjh") heap
Your error is in the last line. `insert (1,"kjh") heap` is an expression, and in
Haskell expressions can only occur inside (function) declarations. So you should
instead write something like:
heap = empty :: MinHeap (Int,String)
heap2 = insert (1,"kjh") heap
In Ghci, expressions are evaluated and the result is printed, which is why you
are able to use it there.
Twan
More information about the Beginners
mailing list