---------------------------------------------------------------------------------------------------

data AParser String = AP {apapply::([String]->[(String,[String])])}

 

Whoa!  You can’t declare a data type like that!  You must have a type variable after the data type name, thus:

 

            data AParser a = AP ....

 

It’s an egregious bug that GHC does not reject your data type declaration.

 

After that, all bets are off.  Some deeply-wired-in invariant is not being obeyed, and all manner of bad things may happen.

 

 

Thank you for showing up the bug -- I’ll fix it.

 

Simon