I have this piece of code in ML:
local
fun unfolder( [] , n ) = []
| unfolder( l::ls, n ) = (n, l) :: unfolder( ls, n )
in
fun flat list = unfolder(list, 1)
end;
this gives me an error:
unexpected exception (bug?) in SML/NJ: EA [EA]
raised at: ../../MLRISC/x86/mltree/x86.sml:417.32-417.34
../compiler/Basics/stats/stats.sml:198.40
../compiler/Basics/stats/stats.sml:198.40
../compiler/Basics/stats/stats.sml:198.40
../compiler/TopLevel/interact/evalloop.sml:44.55
but when I change its (n, l) to (n, l:int), it works, and when (n, l:'a), can someone explain why the polymorphic type does not work, thanks in advance
source
share