mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-24 12:14:26 +03:00
2f6ec76223
* Only normalise a search goal if it's fast While we do end up normalising it anyway on success, there might be things blocking it that make the intermediate terms very big, so only do it speculatively to see if it's quick. * Get information about names in reflection Currently this is only whether it's a function, or data or type constructor. I expect more may be useful/possible.
14 lines
402 B
Idris
14 lines
402 B
Idris
import Language.Reflection
|
|
|
|
%language ElabReflection
|
|
|
|
foo : Elab (NameType, NameType, NameType)
|
|
foo
|
|
= do [n] <- getInfo `{ Prelude.Nat }
|
|
| _ => fail "Can't find Nat"
|
|
[s] <- getInfo `{ Prelude.S }
|
|
| _ => fail "Can't find S"
|
|
[p] <- getInfo `{ Prelude.plus }
|
|
| _ => fail "Can't find plus"
|
|
pure (nametype (snd n), nametype (snd s), nametype (snd p))
|