Indeed, an attempt to match patterns on trustMe, which is not evaluated using refl, leads to a stuck term. May educate (part of) the code that defines the primitive operations for trustMe, primTrustMe:
(u', v') <- normalise (u, v)
if (u' == v') then redReturn (refl $ unArg u) else
return (NoReduction $ map notReduced [a, t, u, v])
Here uand vrepresent the members xand, yrespectively. The rest of the code can be found in the module Agda.TypeChecking.Primitive.
, x y , primTrustMe ( trustMe) , . , Agda Haskell. Agda.Compiler.MAlonzo.Primitives, :
("primTrustMe" , Right <$> do
refl <- primRefl
flip runReaderT 0 $
term $ lam "a" (lam "A" (lam "x" (lam "y" refl))))
: refl , x y. :
module DontTrustMe where
open import Data.Nat
open import Data.String
open import Function
open import IO
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.PropositionalEquality.TrustMe
postulate
trustMe′ : ∀ {a} {A : Set a} {x y : A} → x ≡ y
transport : ℕ → String
transport = subst id (trustMe {x = ℕ} {y = String})
main = run ∘ putStrLn $ transport 42
trustMe transport, (C-c C-x C-c) , ... , - segfault.
, :
DontTrustMe.exe: MAlonzo Runtime Error:
postulate evaluated: DontTrustMe.trustMe′
( , MAlonzo), ( , typecheck , ).
: ( ) . trustMe : Name (Reflection), String (Data.String) Char (Data.Char).
, , , trustMe, . - :
open import Data.Bool
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
open import Relation.Nullary
data X : Set where
a b : X
eq : X → X → Bool
eq a a = true
eq b b = true
eq _ _ = false
dec-eq : Decidable {A = X} _≡_
dec-eq x y with eq x y
... | true = yes trustMe
... | false = no whatever
where postulate whatever : _
, eq, .