Last active
December 22, 2015 20:48
-
-
Save c-spencer/6528482 to your computer and use it in GitHub Desktop.
core.typed messings about
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; trying to work around no update-in type | |
(defmacro typed-update-in [m [v] f] | |
`((ann-form update-in | |
(~'All [~'x ~'y] | |
[ (~'HMap :mandatory {~v ~'x}) (~'Vector* Keyword) [~'x ~'-> ~'y] | |
~'-> | |
(~'HMap :mandatory {~v ~'y}) ])) | |
~m [~v] ~f)) | |
; still causes an error because of the inner un-typed update-in | |
; alternative approach: | |
(defmacro my-update-in [o k f] | |
`(assoc ~o ~k (-> ~o ~k ~f))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment