Debian Codegraph @

tests/monad/tcm/Main.agda

raw
1 {-# OPTIONS --guardedness #-}
2
3 module Main where
4
5 -- Taken from #1530
6
7 open import Data.String.Base using (String)
8 open import Data.Maybe.Base using (Maybe; nothing; just)
9 open import Data.Unit using (⊤; tt)
10
11 open import Reflection.AST.Literal
12 open import Reflection.AST.Term
13 open import Reflection.AST.Show using (showTerm)
14 open import Reflection.TCM using (TC; inferType; unify)
15
16 open import Effect.Monad
17 open RawMonad {{...}} public using (pure; _>>=_; _>>_)
18
19 open import Data.Maybe.Instances
20 open import Reflection.TCM.Instances
21
22 macro
23 goalErr : Term → Term → TC ⊤
24 goalErr t goal = do
25 goalType ← inferType t
26 unify goal (lit (string (showTerm goalType)))
27
28
29 open import IO.Base hiding (_>>=_; _>>_)
30 open import IO.Finite
31 open import IO.Instances
32 open import Function.Base using (_$_)
33
34 main : Main
35 main = run $ do
36 putStrLn (goalErr main)
37 putStrLn (goalErr putStrLn)