[Ur] Unsupported expression

Marco Maggesi maggesi at math.unifi.it
Wed Jan 4 05:40:56 EST 2017


Hello,

I'm trying to figure out what is wrong with this program:

fun mapseq [m ::: Type -> Type] (_ : monad m) [t ::: Type]
           (f : t -> m unit) (ls : list t)
  : m unit
  = case ls of
     [] => return ()
   | h :: t => f h; mapseq f t

val l = "a" :: "b" :: "c" :: []

fun main () =
  mapseq (fn s => debug s) l;
  return <xml/>

If I understand correctly, the code is well-typed and, in my mind,
should be equivalent to

fun main () =
  debug "a";
  debug "b";
  debug "c";
  return <xml/>

But the compiler emits a series of errors "Unsupported expression" and
"Unsupported type constructor".

The first error is

test/test.ur:1:42: (to 1:54) Unsupported expression
Expression:
fn t :: Type =>
 (fn f : t -> FFI(Basis.transaction) {} =>
  (fn ls : FFI(Basis.list) t =>
   case ls of
    FFIC(Basis.Nil) => (_.#Return [{}]) {} |
     FFIC(Basis.Cons) {1 = h, 2 = t} =>
      ((_.#Bind [{}] [{}]) (f h))
       ((fn _ : {} => ((catmap_unpoly _ [t]) f) t))))

Any hint appreciated.

Thanks,
Marco



More information about the Ur mailing list