Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal compiler error #16

Open
ellerh opened this issue Jan 5, 2016 · 0 comments
Open

Internal compiler error #16

ellerh opened this issue Jan 5, 2016 · 0 comments

Comments

@ellerh
Copy link

ellerh commented Jan 5, 2016

The compiler runs into a problem with this code even if it seems to be type-correct (SML/NJ and PolyML accept it):

functor Slice (type 'a elt
               type 'a seq
               val sub : 'a seq * int -> 'a elt) =
  struct
    datatype 'a slice = SLICE of 'a seq
    fun app f (SLICE s) = f (sub (s, 0))
  end

functor MonoSlice (type elt
                   type seq
                   val sub : seq * int -> elt) =
  struct
    structure S = Slice (type 'a elt = elt
                         type 'a seq = seq
                         val sub = sub)
    val app = S.app
    type slice = elt S.slice
    type elt = elt
  end

signature MONO_SLICE =
  sig
      type elt
      type slice
      val app : (elt -> unit) -> slice -> unit
  end

structure S : MONO_SLICE = MonoSlice (type elt = CharVector.elem
                                      type seq = CharVector.vector
                                      val sub = CharVector.sub)

For instance the interpreter stops with an "Exception Zip":

mlworks -tty
Use: /home/helmut/.mlworks
val it : unit = ()
MLWorks 2.1 Professional Edition
Copyright (C) 1999 Harlequin Group plc.  All rights reserved.
MLWorks is a trademark of Harlequin Group plc.

MLWorks> use "test.sml";
Use: /tmp/test.sml
functor MonoSlice
functor Slice
signature MONO_SLICE =
  sig
    type elt
    type slice
    val app : (elt -> unit) -> slice -> unit
  end
Entering Debugger, scanning stack ... done.
Exception Zip[_lists.sml:128.15-128.17] raised
Entering debugger, commands: q : quit (return to listener),  ? : more help
Current (innermost) stack frame:
No visible frame
Debugger> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant