-
Notifications
You must be signed in to change notification settings - Fork 4
18. HC18 ‐ Haskell Chapter 18 Practical Tasks: Functor
Bernard Sibanda edited this page Mar 17, 2025
·
1 revision
-
HC18T1: Define a function
mapToLowerusingfmapthat converts all characters in a list to lowercase. -
HC18T2: Create a Functor instance for the binary tree type
Tree. -
HC18T3: Define a function
incrementTreeValuesthat adds one to every value in a tree using the Functor instance. -
HC18T4: Implement a function
mapToBitsto convert a list of Booleans to characters '1' or '0' usingfmap. -
HC18T5: Define a Functor instance for the
Eithertype, applyingfmaponly to theRightcase. -
HC18T6: Implement a function
applyToMaybethat usesfmapto transform the value inside aMaybe. -
HC18T7: Define a function
fmapTuplethat applies a function to the second element of a tuple(a, b)using the Functor instance of(,) a. -
HC18T8: Implement the
identityLawCheckfunction to verify the Functor identity law. -
HC18T9: Implement the
compositionLawCheckfunction to verify the Functor composition law. -
HC18T10: Create a function
nestedFmapthat applies a function to a nested structure using multiplefmapcalls.
-
HC11T1: Implement a Functor instance for a three-element tuple
((,,) a b). -
HC11T2: Define a function
fmapTriplethat applies a function to the third element of a three-element tuple.
-
HC12T1: Write a function
nestedMapthat applies a function to a nested Functor of depth 2. - HC12T2: Test the identity law on a nested Functor structure.
-
HC13T1: Create a Functor instance for the function type
((->) r). - HC13T2: Implement a function that applies fmap to a function type and composes transformations.
-
HC14T1: Define a function
replaceInFunctorusing the<$operator to replace all values in a Functor with a single constant. -
HC14T2: Implement and test the flipped version
$>to achieve the same as<$.
-
HC15T1: Write a function
applyVoidusingvoidto trigger side effects within a Functor while discarding the result. -
HC15T2: Test void on different Functors like
Maybe,[], and custom types.
Finished. Congratulations! Get your progress token here
Bernard Sibanda is a global Technology Entrepreneur, Web3 and Software Consultant with a deep focus on Cardano Blockchain, Midnight and Community building.
Key Positions:
- Founder, CTO, Developer Advocate cohort #1, Fullstake Developer, Cardano Ambassador, Catalyst Project Manager, DREP-WIMS:
- Co-founder of ABL Tech and Cardano Africa Live
- EBU-certified Plutus Pioneer (Plutus/Haskell)
- Cohort #1 Plutus Pioneer Developer
- Catalyst Community Reviewer & Funded Projects Manager
-
DRep for WIMS-Cardano (ID:
drep1yguj8zu48n99pv70yl6ckzt9hdgjy8yjnlqs2uyzcpafnjgu4vkul) - Intersect Developer Advocate
- Intersect Committe Member 2025-2026
- Cardano Marketer,Promoter and blogger
- Cardano Open Source Contributor
- Cardano communities and events organizer and builder
- Cardano Ambassador for South Africa
Official links:
- Stablecoins Dex
- Coxygen Global Universities
- WIMS Cardano Global
- Cardano Africa Live
- WIMS Cardano Videos
- Cardano Smart Contract Videos
- Fullstack IT Consulting
Social links: