summaryrefslogtreecommitdiff
path: root/Bidir.agda
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2012-01-22 23:11:19 +0100
committerHelmut Grohne <helmut@subdivi.de>2012-01-22 23:11:19 +0100
commit6e3b0445d0c7a412f1dde5d9abf9e97b26e1cfe8 (patch)
treed9a6a16bfaf9feab7c7ac4709e054cb95a63de61 /Bidir.agda
parent8ad3dfdcba5a664850f3451d4b89634efcc3fd25 (diff)
downloadbidiragda-6e3b0445d0c7a412f1dde5d9abf9e97b26e1cfe8.tar.gz
actually fmap is what I meant instead of >>=
Diffstat (limited to 'Bidir.agda')
-rw-r--r--Bidir.agda7
1 files changed, 5 insertions, 2 deletions
diff --git a/Bidir.agda b/Bidir.agda
index 79412e0..32397af 100644
--- a/Bidir.agda
+++ b/Bidir.agda
@@ -15,6 +15,9 @@ open import Relation.Binary.PropositionalEquality
_>>=_ : {A B : Set} → Maybe A → (A → Maybe B) → Maybe B
_>>=_ = flip (flip maybe′ nothing)
+fmap : {A B : Set} → (A → B) → Maybe A → Maybe B
+fmap f = maybe′ (λ a → just (f a)) nothing
+
module FinMap where
FinMapMaybe : ℕ → Set → Set
@@ -96,8 +99,8 @@ bff : ({A : Set} → List A → List A) → ({B : Set} → EqInst B → List B â
bff get eq s v = let s′ = idrange (length s)
g = fromFunc (λ f → lookupVec f (fromList s))
h = assoc eq (get s′) v
- h′ = h >>= (λ jh → just (union jh g))
- in h′ >>= (λ jh′ → just (map (flip lookup jh′) s′))
+ h′ = fmap (flip union g) h
+ in fmap (flip map s′ ∘ flip lookup) h′
theorem-1 : (get : {α : Set} → List α → List α) → {τ : Set} → (eq : EqInst τ) → (s : List τ) → bff get eq s (get s) ≡ just s
theorem-1 get eq s = {!!}