coalton-lang/coalton

`Seq` doesn't handle type inference as well as `Vector` equivalents

Opened this issue · 0 comments

(coalton-toplevel

  (define (vec-example)
    (vec:make "wow" "ok" (into 3)))

  ;; doesn't compile
  (define (seq-breaks)
    (seq:make "wow" "ok" (into 3)))

  ;; also doesn't compile
  (define (seq-also-breaks)
    (the (seq:Seq String)
         (seq:make "wow" "better" (into 3))))

  ;; compiles
  (define (seq-works)
    (seq:make "wow" "better" (the String (into 3)))))

This is the error from seq-break:

error: Ambiguous predicate
  --> <macroexpansion>:5:31
   |
 5 |      (SEQ:MAKE "wow" "ok" (INTO 3))))
   |                                 ^ Ambiguous predicate NUM :A
   [Condition of type SB-INT:COMPILED-PROGRAM-ERROR]

And from seq-also-breaks:

error: Ambiguous predicate
  --> <macroexpansion>:5:57
   |
 5 |      (THE (SEQ:SEQ STRING) (SEQ:MAKE "wow" "better" (INTO 3))))
   |                                                           ^ Ambiguous predicate NUM :A
   [Condition of type SB-INT:COMPILED-PROGRAM-ERROR]