Learning viewShow only the learning panels you need.
Practical Tasks: Introduction to Haskell
1. Introduction to Haskell · 0 min · Haskell / Plutus
Haskell Intermediate practical lesson. This lesson contains 8 hands-on coding tasks. Read each task, implement it in the Haskell editor, test the result, then mark the task complete locally.
Practical tasksLocal progress: 0%
HC1T1 - Task 1: Function Composition
double: Multiplies a number by 2.
increment: Increases a number by 1.
doubleThenIncrement: Uses function composition to apply double first and then increment.
HC1T2 - Task 2: Pure Function Example
Write a function circleArea that calculates the area of a circle given the radius. Ensure that it’s pure and does not depend on any external state.
HC1T3 - Task 3: Checking if a Number is Greater than 18
Write a function greaterThan18 that checks whether a given number is greater than 18.
HC1T4 - Task 4: Composing a Function to Process Player Data
extractPlayers: Takes a list of tuples ((name, score)) and extracts the player names.
sortByScore: Sorts the list of players by score in descending order.
topThree: Returns the top three players.
Compose these functions into getTopThreePlayers.
HC1T5 - Task 5: Laziness in Haskell
Create a function infiniteNumbers that generates an infinite list of numbers. Extract only the first n elements.
HC1T6 - Task 6: Using Type Signatures
Define a function addNumbers that takes two integers and returns their sum.
HC1T7 - Task 7: Converting Fahrenheit to Celsius
Write a function fToC that converts Fahrenheit to Celsius.
HC1T8 - Task 8: Higher-Order Functions
Create a function applyTwice that applies a function twice to an input value.
Haskell Practical Lab - Introduction to Haskell: Complete all 8 practical tasks in this chapter. Use the embedded OneCompiler Haskell editor to implement and test each solution. Keep your final source code for your own project/review evidence.