racket / rhombus

Rhombus programming language
Other
355 stars 63 forks source link

map wrongly expects a PairList #594

Closed samth closed 4 hours ago

samth commented 23 hours ago

This program:

#lang rhombus

fun run1(inp :: String):
  print((inp.split("\n")).map(fun (k :: String): (k.split())))

run1("x y\na b\n")

produces the error:

PairList.map: value does not satisfy annotation
  value: ["x y", "a b"]
  annotation: PairList
Context (plain):
 /home/samth/sw/plt/extra-pkgs/rhombus-prototype/rhombus-lib/rhombus/private/define-arity.rkt:94:11 PairList.map
 day1.rhm:6:0 run1
 /home/samth/sw/racket-mode/racket/repl.rkt:323:0 configure/require/enter

Annotating the inp.split("\n") expression as a List fixes the error.

mflatt commented 21 hours ago

The problem is that String.split has PairList for its declared result instead of List. I'll fix it.