From d0f0d271ea8f9963f99c6a7fb14ba69f067b7bee Mon Sep 17 00:00:00 2001 From: Yuri Tatishchev Date: Sun, 1 Mar 2026 22:16:03 -0800 Subject: [PATCH] lab07: impl functor --- lab07/facetedValues.lhs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lab07/facetedValues.lhs b/lab07/facetedValues.lhs index 6a7815b..71695d5 100644 --- a/lab07/facetedValues.lhs +++ b/lab07/facetedValues.lhs @@ -42,7 +42,8 @@ be applied to every element of the tree. As a review of the last lab, define fmap for FacetedValues. > instance Functor FacetedValue where -> fmap f v = error "Your code here" +> fmap f (Raw x) = Raw (f x) +> fmap f (Facet label auth unauth) = Facet label (fmap f auth) (fmap f unauth) The following function gives an example of how a FacetedValue can be used. @@ -67,7 +68,7 @@ In order to make that work, we need need to add support for Applicative Functors Define the behavior of the Functor below > instance Applicative FacetedValue where -> pure = error "Your code here" +> pure = Raw > fv1 <*> fv2 = error "Your code here"