Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell, error "Qualified name in binding position "

import qualified Data.Sequence as Seq

data Heap a = EmptyHype | Seq.Seq (Seq.Seq ) Int  deriving (Show, Read, Eq)

I get the error Qualified name in binding position: Seq.Seq I read about this problem and as far as I undestood I can't use Seq.Seq but only Seq (Seq a) , but I need to qualify it as Seq because I wouldn't be able to use some functions.

Of course I am probably wrong that's why I ask here.

like image 946
user3129475 Avatar asked Nov 21 '25 18:11

user3129475


1 Answers

You need a constructor name for the second part of your data. The following compiles:

data Heap a = EmptyHype 
            | Nonempty (Seq.Seq (Seq.Seq a)) Int
  deriving (Show, Read, Eq)

You also needed to fully apply the (second) Seq.Seq, which is why I grouped the parens how I did.

like image 86
crockeea Avatar answered Nov 24 '25 10:11

crockeea



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!