Skip to content

Instantly share code, notes, and snippets.

@owickstrom
Created December 11, 2014 05:01
Show Gist options
  • Save owickstrom/5695e0591ef245305f27 to your computer and use it in GitHub Desktop.
Save owickstrom/5695e0591ef245305f27 to your computer and use it in GitHub Desktop.
core.typed pmap error
(require '[clojure.core.typed :as t])
; This seem to work nicely
(t/cf (identity 1)) ;=> [(t/Val 123) {:then tt, :else ff}]
; And this
(t/cf pmap) ;=> (All [c a b ...] (t/IFn [[a b ... b -> c] (t/NonEmptySeqable a) (t/NonEmptySeqable b) ... b -> (t/NonEmptyASeq c)] [[a b ... b -> c] (t/U nil (Seqable a)) (t/U nil (Seqable b)) ... b -> (t/ASeq c)]))
; But when I combine the two...
(t/cf (pmap identity [1 2 3]) ;=> Type Error (/tmp/form-init5174330476817989076.clj:1:7) Polymorphic function pmap could not be applied to arguments:
; ...
; If I pmap using a non-polymorphic (?) function, at least not polymorphic in its range, it seems to work fine.
(t/cf (map println [1 2 3]) ;=>
;2
;1
;3
;(t/NonEmptyASeq nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment