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"