Skip to content

Commit

Permalink
define non-trivial functor
Browse files Browse the repository at this point in the history
  • Loading branch information
neduard committed Jun 25, 2024
1 parent fff1097 commit bbd11c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions codebase2/codebase-sqlite/U/Codebase/Sqlite/Patch/TermEdit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ type Referent' t h = Referent.Referent' (Reference' t h) (Reference' t h)
data TermEdit' t h = Replace (Referent' t h) Typing | Deprecate
deriving (Eq, Ord, Show)

instance Functor (TermEdit' t) where
fmap :: (a -> b) -> TermEdit' t a -> TermEdit' t b
fmap f (Replace (Referent.Ref termRef) typing) = Replace (Referent.Ref (fmap f termRef)) typing
fmap f (Replace (Referent.Con typeRef consId) typing) = Replace (Referent.Con (fmap f typeRef) consId) typing
fmap _ Deprecate = Deprecate

_Replace :: Prism (TermEdit' t h) (TermEdit' t' h') (Referent' t h, Typing) (Referent' t' h', Typing)
_Replace = prism embed project
where
Expand Down

0 comments on commit bbd11c9

Please sign in to comment.