-
Notifications
You must be signed in to change notification settings - Fork 4
19. HC19 ‐ Haskell Chapter 19 Practical Tasks: Applicative
Bernard Sibanda edited this page Mar 17, 2025
·
1 revision
- HC19T1: Define an
Applicativeinstance for a custom data typePair a. - HC19T2: Implement a function
addThreeApplicativethat adds threeMaybe Intvalues using applicative style. - HC19T3: Define a function
safeProductthat calculates the product of a list ofMaybe Intvalues, returningNothingif any value isNothing. - HC19T4: Create a function
liftAndMultiplythat lifts a binary function(Int -> Int -> Int)usingliftA2. - HC19T5: Implement the function
applyEffectsusing<*>, where it takes a tuple(IO Int, IO Int)and sums the values while printing them. - HC19T6: Define the function
repeatEffectthat repeatedly executes an effect usingforever. - HC19T7: Write a function
conditionalPrintusingwhenthat prints a message only when a given condition is true. - HC19T8: Implement a custom function
discardSecondthat uses the<*operator to return the first argument after sequencing effects. - HC19T9: Implement
pureAndApplywhich demonstrates howpureworks with applicative effects. - HC19T10: Create a function
combineResultsthat combines twoEithervalues using applicative style. - HC11T1: Define an
Applicativeinstance for a custom data typeWrapper a. - HC11T2: Implement a function
sumThreeApplicativethat adds threeEither String Intvalues using applicative style. - HC12T1: Implement the
whenApplicativefunction that executes an action conditionally when a Bool is true. - HC12T2: Define a function
replicateEffectthat replicates a given IO action a specified number of times usingreplicateM. - HC13T1: Create a function
sequenceEffectsthat combines a list of applicative effects into a single effect. - HC14T1: Implement
applyWithEffectsto show how the<*>operator sequences two effects. - HC15T1: Implement a function
simulateMaybeEffectthat applies a function to multipleMaybevalues using applicative style. - HC16T1: Define a function
combineEitherResultsthat handles multipleEithercomputations with potential errors. - HC17T1: Implement the function
sequenceApplicative, combining a list ofMaybevalues and returning aMaybe [a]. - HC18T1: Implement a function
replicateForeverthat applies an IO action infinitely usingforever.
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: