Skip to content

Instantly share code, notes, and snippets.

@begeric
Created January 3, 2015 21:59
Show Gist options
  • Select an option

  • Save begeric/e2191d3d5ccf22b0dcea to your computer and use it in GitHub Desktop.

Select an option

Save begeric/e2191d3d5ccf22b0dcea to your computer and use it in GitHub Desktop.
(collect {
case t @ Defn.Val(_, _, None, _) =>
message(t, t.getType)
case t @ Defn.Def(_, _, _, _, None, _) =>
message(t, t.getType)
} <~
update {
case t @ Defn.Val(mods, pats, None, rhs) =>
Defn.Val(mods, pats, Some(t.getType), rhs)
} +
update {
case t @ Defn.Def(mods, name, tparams, paramss, None, body) =>
Defn.Def(mods, name, tparams, paramss, Some(t.getType), body)
}).down
===>>
(transform {
case t @ Defn.Val(mods, pats, None, rhs) =>
Defn.Val(mods, pats, Some(t.getType), rhs) andCollect message(t, t.getType)
case t @ Defn.Def(mods, name, tparams, paramss, None, body) =>
Defn.Def(mods, name, tparams, paramss, Some(t.getType), body) andCollect message(t, t.getType)
}).down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment