Hello,

My apologizes if this questions have already been answer in this list, I may 
have missed.

I'm trying to make this expression work in typed/racket:

    (map car '((1 . 2) (3 . 4)))

But if fails with the following type error:

; Type Checker: Polymorphic function `map' could not be
;   applied to arguments:
; Domains: (-> a b ... b c) (Listof a) (Listof b) ... b
;          (-> a c) (Pairof a (Listof a))
; Arguments: (All (a b) (case-> (-> (Pairof a b) a) (-> (Listof a) a))) (List
;   (Pairof One Positive-Byte) (Pairof Positive-Byte Positive-Byte))
;   in: (map car (quote ((1 . 2) (3 . 4))))

I tried annotating the type of the second argument to "map" like:

   (: L (Listof (Pairof Any Any)))
   (define L '((1 . 2) (3 . 4)))

Which type checks successfully, but then again I get the same error when 
evaluating:

    (map car L)

It seems to me that the type of "map":

map
- : (All (c a b ...)
      (case->
       (-> (-> a c) (Pairof a (Listof a)) (Pairof c (Listof c)))
       (-> (-> a b ... b c) (Listof a) (Listof b) ... b (Listof c))))

and the type of "car":

car
- : (All (a b) (case-> (-> (Pairof a b) a) (-> (Listof a) a)))

Are compatible with the type of "L" - but I'm failing to understand the meaning 
of the type check error message.

The empty list is the only expression that I was able to make it work in "(map 
car <>)".

    (map car '())
    - : (Listof Any)
    '()

Appreciate your help!
Best Regards
- Rodrigo

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to