37 |
4 |
HP-37-37 Ledger-V1-Hakell Plutus Smart Contracts |
Plutus.V1.Ledger is a collection of types and utilities from the Plutus smart contract platform used to build secure, type-safe smart contracts for Cardano. It includes definitions for: |
Open |
2025-09-20 11:43:56 |
36 |
4 |
HP-36-36. Oracles-Hakell Plutus Smart Contracts |
An oracle bridges off-chain data to the blockchain. Smart contracts on Cardano can_SingleQuote_t directly access external data like exchange rates, weather, or random numbers. Oracles solve this by publishing such data on-chain in a secure and verifiable way. |
Open |
2025-09-20 11:34:11 |
35 |
4 |
HP-35-35. Atomic Swap-Hakell Plutus Smart Contracts |
This contract implements a Hashed Timelock Contract (HTLC), which enables secure, trustless, and time-limited swaps of assets between two parties. The contract has two unlock conditions: ✅ Hashlock: Receiver must reveal the preimage of a given hash before the deadline. ⏳ Timelock: If deadline passes, the sender can reclaim the funds. |
Open |
2025-09-20 11:16:01 |
34 |
4 |
HP-34-34. Prelude-Hakell Plutus Smart Contracts |
PlutusTx.Prelude is a safe, deterministic alternative to Haskell_SingleQuote_s standard Prelude, designed for Plutus on-chain code. ✅ You must use it for code that’s compiled with the Plutus Tx compiler: {- |
Open |
2025-09-20 10:52:23 |
33 |
4 |
HP-33-33. Lift-Hakell Plutus Smart Contracts |
In Plutus, lifting refers to the process of converting Haskell values into Plutus Core constants so they can be used inside on-chain scripts. This is crucial because: Plutus Core (on-chain) has a limited set of primitive types. Haskell (off-chain) has a much richer type system. |
Open |
2025-09-20 10:08:42 |
32 |
4 |
HP-32-32. Value-Hakell Plutus Smart Contracts |
The Plutus.V1.Ledger.Value module handles multi-currency amounts in Plutus:
CurrencySymbol and TokenName for identifying tokens.
AssetClass as a pair of symbol and name.
Value as a nested map from symbols to token names to integer quantities.
Utilities for constructing, querying, combining, and comparing Values |
Open |
2025-09-20 10:12:06 |
31 |
4 |
HP-31-31. ADA-Hakell Plutus Smart Contracts |
Plutus contracts often need to handle ADA - the native currency of Cardano. This module simplifies how you represent, create, and manipulate Ada values and convert them to/from Value.
The module gives you:
Strong type safety via the Ada newtype
Easy constructors and extractors
Helpers for conversion and arithmetic |
Open |
2025-09-20 10:24:18 |
30 |
4 |
HP-30-30. Crypto-Hakell Plutus Smart Contracts |
The Plutus.V1.Ledger.Crypto module introduces the PubKeyHash type, a lightweight wrapper around a built?in byte string used to identify public keys on?chain.
It covers:
A zero?cost newtype for public key hashes
Derivations for on?chain and off?chain typeclasses (Eq, Ord, ToData, etc.)
IsString and pretty printing via LedgerBytes
On?chain lifting with makeLift |
Open |
2025-09-20 10:13:08 |
29 |
4 |
HP-29-29. Slot and TimeRanges-Hakell Plutus Smart Contracts |
Time-sensitive logic is common in Plutus smart contracts. You often need to:
Enforce deadlines
Allow scheduled unlocks
Handle auction close times
Plutus uses POSIXTime and Interval POSIXTime (a.k.a. POSIXTimeRange) to model time. You do not check Slot directly on-chain-it's for off-chain conversion. |
Open |
2025-09-20 10:24:40 |
28 |
4 |
HP-28-28. Contexts-Hakell Plutus Smart Contracts |
The Plutus.V2.Ledger.Contexts module defines the on-chain view of pending transactions for Plutus V2 scripts. It provides:
Data structures: TxInInfo, TxInfo, and ScriptContext capturing inputs, outputs, redeemers, and transaction metadata.
ScriptPurpose: tags indicating why a script is run (e.g. spending, minting).
Functions: to locate the current input, retrieve datums, compute continuing outputs, and summarize values.
Instances: on-chain equality, Pretty, and serialization via makeIsDataIndexed and makeLift. |
Open |
2025-09-20 10:14:26 |
27 |
4 |
HP-27-27. Scripts-Hakell Plutus Smart Contracts |
The Plutus.V1.Ledger.Scripts module provides the core abstractions and utilities for working with on-chain scripts in Plutus:
Script: opaque representation of a UPLC program.
Wrappers: Validator, MintingPolicy, and StakeValidator for specific script roles.
Data wrappers: Datum, Redeemer, and Context for script inputs.
Hash types: ScriptHash, ValidatorHash, DatumHash, etc., for script identification.
Evaluation: functions to apply and run scripts, extracting budgets and logs.
Utilities: scriptSize, fromCompiledCode, applyArguments, and example unitDatum/unitRedeemer. |
Open |
2025-09-20 10:14:52 |
26 |
3 |
HP-26-26. TxConstraint-Hakell Plutus Smart Contracts |
The Ledger.Tx.Constraints module defines transaction constraints (TxConstraints), which are declarative rules for transactions.
Off-chain (wallet/backend): Used to build transactions (mkTx).
On-chain (validator): Used to verify that transactions meet rules (checkScriptContext).
This helps ensure correctness and reduces boilerplate transaction logic. |
Open |
2025-09-20 10:16:11 |
25 |
3 |
CA-25-25. Cardano Archictecture |
CA-25-25. Cardano Archictecture |
Open |
2025-09-18 03:20:28 |
24 |
3 |
CA-24-24. Cardano Archictecture |
CA-24-24. Cardano Archictecture |
Open |
2025-09-18 03:19:57 |
23 |
3 |
CA-23-23. Cardano Archictecture |
CA-23-23. Cardano Archictecture |
Open |
2025-09-18 03:19:15 |
22 |
3 |
CA-22-22. Cardano Archictecture |
CA-22-22. Cardano Archictecture |
Open |
2025-09-18 03:18:08 |
21 |
2 |
HC21-21. Haskell Chapter 21 Practical Tasks: Monad Trasnsformers |
This Tasks is about Monad transformers : Reader, Writer and State Monads |
Open |
2025-09-20 10:22:48 |
20 |
2 |
HC20-20. Haskell Chapter 20 Practical Tasks: Monad |
A Monad in Haskell is an abstraction that extends Functors and Applicative Functors, providing a structured way to handle computations with context and effects. Monads enable sequential composition, allowing functions that return wrapped values (e.g., Maybe a, IO a, Either e a) to be chained together seamlessly.
? Key Features
Bind (>>=) - Chains computations while preserving context.
return - Lifts a value into a monadic context.
Monad Laws - Ensure consistent and predictable behavior.
Common Monads - Examples include:
Maybe (for optional values)
IO (for side effects)
Either (for error handling)
[] (list, for nondeterminism)
and more.
Monads help manage side effects, handle errors, and structure computations cleanly, making them one of Haskell's most powerful and widely used abstractions. |
Open |
2025-09-20 10:39:46 |
19 |
2 |
HC19-19. Haskell Chapter 19 Practical Tasks: Applicative |
This lesson covers Applicative Functors, which extend Functors by enabling multi-argument function application within a context. They bridge the gap between simple Functors and more powerful abstractions like Monads. By the end, you'll see why Applicatives are essential and how they provide a structured way to work with functions in contexts.
? Key Topics
Why Applicative Functors? - Understanding how they solve the limitations of plain Functors.
Function application at the Functor level - Using <*> for contextual application.
Being pure - Lifting ordinary values into a context with pure. |
Open |
2025-09-20 10:36:53 |
18 |
2 |
HC18-18. Haskell Chapter 18 Practical Tasks: Functor |
This lesson dives into Functors, a fundamental abstraction in Haskell. If you've ever used map, you've already worked with Functors! By the end, you'll understand Functors conceptually and know how to use them effectively.
? Key Topics
Generalizing map - Functors let you apply functions inside various structures.
The Functor type class - Defines fmap and <$>.
Defining Functor instances - How to make your custom types functorial.
Unexpected Functor instances - Examples include Either a, (,) a, and (->) r.
Lifting functions - Applying ordinary functions to values inside contexts. |
Open |
2025-09-20 10:37:11 |
17 |
2 |
HC17-17. Haskell Chapter 17 Practical Tasks: Semigroup-and-Monoid |
This lesson kicks off the "Abstracting Patterns" section by introducing the concepts of abstraction and two fundamental type classes in Haskell: Semigroup and Monoid. Key Topics Covered: " What does it mean to abstract a pattern? " Understanding how abstraction allows us to generalize and reuse common structures in programming. Why abstract patterns? " Exploring the benefits of abstraction, such as reducing code duplication, improving maintainability, and increasing flexibility. Teaser: Why abstract Semigroup and Monoid? " An introduction to how these abstractions help us work with composable binary operations and identity values. The Semigroup type class " Learning how Semigroup defines an associative operation (<>) that combines two values of the same type. The Monoid type class " Extending Semigroup with an identity element (mempty), which acts as a neutral starting point for composition. What can we do with Semigroup and Monoid? " Practical applications, such as combining lists, numbers, functions, and custom data structures in a clean, reusable way. By mastering Semigroup and Monoid, Haskell developers gain powerful tools for structuring code and working with abstract, composable operations in a highly expressive manner. |
Open |
2025-09-20 10:31:17 |
16 |
2 |
HC16-16. Haskell Chapter 16 Practical Tasks: Gaining-your-independence-and-project |
This lesson, "Gaining Your Independence," equips developers with essential tools and techniques to become more self-sufficient in Haskell development. It focuses on small but powerful tips and tricks that streamline coding, debugging, and learning. Key topics include: " REPL (Read-Eval-Print Loop) Using GHCi to test code interactively, explore functions, and debug efficiently." Hackage Haskell's central package repository, where developers can find libraries, documentation, and community contributions." Hoogle A search engine for Haskell functions and types, helping developers quickly locate relevant functionality." undefined A placeholder for incomplete code, useful when structuring functions before full implementation." Type Holes A feature that allows developers to leave gaps in their code (_) and let the compiler suggest the expected type, making debugging and development smoother. The section wraps up with a final project, reinforcing these concepts in a hands-on way. By mastering these tools, Haskell developers can gain independence, troubleshoot effectively, and build confidence in writing and exploring Haskell code. |
Open |
2025-09-20 10:29:39 |
15 |
2 |
HC15-15. Haskell Chapter 15 Practical Tasks: Handling-Errors |
This lesson dives into error handling in Haskell, focusing on two main categories: Compile-time errors Compile-time errors are a developer’s best friend! They help catch mistakes before the program runs, ensuring that incorrect code doesn’t reach end users. Haskells strong type system and purity significantly reduce runtime errors by enforcing correctness at compile time. This is why many say, "In Haskell, if it compiles, it works." Runtime errors While Haskell minimizes runtime errors, they can still occur due to unpredictable real-world conditions—such as out-of-memory issues, missing files, network failures, or unexpected user behavior. Unlike compile-time errors, these happen when the program is already running, potentially frustrating users. The lesson covers how to handle runtime errors gracefully while leveraging Haskells type system to push as many errors as possible to compile time. By doing so, developers can build more reliable software, ensuring a smoother experience for both users and maintainers. |
Open |
2025-09-20 10:21:12 |
14 |
2 |
HC14-14. Haskell Chapter 14 Practical Tasks: Cabal_and_language_extensions |
This lesson introduces Cabal and Language Extensions, essential tools for managing Haskell projects and extending the language’s capabilities. It begins with an introduction to Cabal, Haskell’s build system and package manager, explaining how it simplifies dependency management and project organization. Learners will then create a new Haskell project, exploring the Cabal file, which defines project metadata, dependencies, and configurations. Using an external library, the lesson demonstrates how to integrate third-party functionality. The process of building and running the executable is covered, ensuring a smooth workflow for Haskell development. The lesson then shifts to language extensions and pragmas, which unlock advanced Haskell features beyond the standard language definition. Two specific extensions are highlighted: NumericUnderscores, which improves number readability, and TypeApplications, which allows explicit type specification for polymorphic functions. As with previous topics, both video and written materials complement each other—videos provide practical demonstrations, while written content offers structured, sequential explanations. By mastering Cabal and language extensions, developers gain greater control over their projects and unlock powerful features to enhance their Haskell programming experience |
Open |
2025-09-20 10:20:58 |
13 |
2 |
HC13-13. Haskell Chapter 13 Practical Tasks: Modules |
This lesson introduces modules in Haskell, essential for organizing, structuring, and reusing code effectively. It starts with importing modules, explaining how to access predefined functionality from Haskell’s extensive libraries. Managing environments and namespaces is crucial, so the lesson covers techniques for controlling which functions and types are imported, avoiding conflicts, and maintaining clarity. After understanding how to use existing modules, the lesson moves on to creating our own modules, demonstrating how to define, export, and structure code efficiently. A key part of the lesson explores The Prelude and Standard Libraries, the foundational modules that provide essential functions without requiring explicit imports. Throughout, learners are encouraged to leverage both video and written materials, as each format offers unique advantages—video for live refactoring demonstrations and written explanations for structured, sequential learning. By mastering modules, developers gain the ability to build scalable and maintainable Haskell programs. |
Open |
2025-09-20 10:20:43 |
12 |
2 |
HC12-12. Haskell Chapter 12 Practical Tasks: Installing-Haskell-and-first-program |
This lesson marks the beginning of a hands-on journey into Haskell development, focusing on setting up a local environment and running the first program. It starts with installing Haskell, using GHCup, a tool that simplifies managing Haskell versions. Through GHCup, we install GHC (Glasgow Haskell Compiler), Cabal (build tool), Stack (alternative build tool), and HLS (Haskell Language Server) to streamline development. Next, we configure VSCode extensions to enhance productivity with syntax highlighting, code completion, and error checking. With the environment set up, we move on to writing the simplest Haskell program, introducing the basic syntax and structure. The final step is compiling and running our program, demonstrating how Haskell code transforms into an executable. This lesson lays the foundation for a smooth development workflow, preparing us for more advanced Haskell programming in upcoming lessons. |
Open |
2025-09-20 10:20:29 |
11 |
2 |
HC11-11. Haskell Chapter 11 Practical Tasks: Basic-IO |
This topic introduces Basic I/O in Haskell, a language primarily centered around pure functions. It begins by contrasting pure functions with IO actions, which allow interaction with the outside world while maintaining Haskell’s functional nature. The inner workings of IO actions are explored, followed by practical usage, including how Haskell handles side effects. The () type is introduced as a placeholder for actions that don’t return meaningful values. Developers learn to interact with users through fundamental functions like getChar, getLine, and putStrLn. Since actions are first-class values, they can be manipulated like other functions. The lesson then covers composing IO actions using the >> and >>= operators, which help sequence operations. The do block is introduced as a way to write readable, imperative-style IO code, including using let, nesting do-blocks, escaping IO, and the return function to integrate IO with pure functions. Finally, the concept of the main action is explained as the entry point of Haskell programs, followed by a recap of key takeaways. By mastering these concepts, developers can effectively handle user input and output while keeping their code structured and idiomatic. |
Open |
2025-09-20 10:20:15 |
10 |
2 |
HC10-10. Haskell Chapter 10 Practical Tasks: Creating-Type-Classes-and-Instances |
This topic explores creating type classes and instances in Haskell, allowing developers to define reusable behavior across multiple types. It begins with overloading, explaining how type classes enable polymorphic functions. The step-by-step process of defining a type class is introduced using the Eq type class, followed by creating multiple instances for different types. The lesson then demonstrates how to improve Eq using mutual recursion and the mathematical concept of the greatest common divisor (MCD). A key challenge—defining an instance for a parameterized type—is covered, ensuring flexibility in type definitions. Two example type classes, WeAccept and Container, illustrate how custom type classes can model real-world concepts. The lesson also explores the Ord type class, introducing subclassing, where one type class depends on another. Finally, the deriving mechanism is explained, showing how Haskell can automatically generate instances, along with pitfalls where deriving can go wrong. By mastering these concepts, developers can create powerful abstractions and write more reusable, maintainable Haskell code. |
Open |
2025-09-20 10:19:22 |
9 |
2 |
HC9-9. Haskell Chapter 9 Practical Tasks : Creating-parameterized-and-recursive-types |
This topic explores creating parameterized and recursive types in Haskell, extending the ability to define custom types. It begins with parameterizing types, showing how to create flexible and reusable abstractions. This includes parameterizing type synonyms for improved readability and parameterizing data types to allow them to work with multiple types. The concept of recursive data types is then introduced, enabling structures that reference themselves. Examples include Tweet me a river (a practical example of recursion), a sequence of nodes (linked list-like structures), and a tree of nodes (hierarchical data structures). The lesson also touches on kinds, which describe the type of a type, and concludes with the newtype keyword, which provides a way to define new types with minimal overhead. By mastering these concepts, developers can build more expressive and efficient data structures in Haskell. |
Open |
2025-09-20 10:18:04 |
8 |
2 |
HC8-8. Haskell Chapter 8 Practical Tasks: Creating-non-parameterized-types |
This topic focuses on creating non-parameterized types in Haskell, building on prior knowledge of what types are and why they are useful. It begins with type synonyms, explaining how to define them and why they improve code readability and maintainability. Next, it introduces new types using the data keyword, detailing how to create and use custom types effectively. The concept of value parameters is explored, showing how types can hold specific values. Finally, record syntax is introduced as a convenient way to define structured data with named fields, enhancing code clarity and accessibility. By the end of this lesson, developers will have a solid foundation for defining their own types, enabling better organization and abstraction in their Haskell programs. |
Open |
2025-09-20 10:17:28 |
7 |
2 |
HC7-7 Haskell Chapter 7 Practical Tasks: Intro‐to‐Type‐Classes |
This topic introduces type classes in Haskell from the perspective of a developer who wants to understand and use them. It begins by highlighting the awesomeness of type classes, showcasing their power in enabling polymorphism and code reuse. The core question—What are type classes?—is explored, explaining how they define behavior that different types can implement. Several common type classes are covered, including Eq (equality comparison), Ord (ordering), Num, Integral, and Floating (numeric operations), and Read and Show (conversion between strings and values). The discussion extends to determining the most general valid type for a function and handling multiple constraints when a function requires more than one type class. This serves as a foundational guide for using type classes effectively, while a future lesson will explore how to create new type classes and instances. |
Open |
2025-03-19 16:57:16 |
6 |
2 |
HC6-6. Haskell Chapter 6 Practical Tasks: Recursion‐and‐folds |
This topic delves into recursion and folds, fundamental concepts in functional programming. It begins with why recursion is important, explaining how it provides a natural way to solve problems by breaking them into smaller subproblems. Thinking recursively is key to writing effective recursive functions, demonstrated through basic examples like sum and product. The process of creating a recursive function is outlined with step-by-step guidance, followed by practical examples such as and, length, reverse, drop, take, map, and filter. The discussion then shifts to foldr, a pattern for extracting recursion into a higher-order function. The foldl and foldlPrime functions are introduced, explaining their differences in terms of strictness and performance. Finally, best practices for choosing between foldr, foldl, and foldlPrime are covered, ensuring efficient and idiomatic functional programming. |
Open |
2025-03-19 16:55:37 |
5 |
2 |
HC5-5. Haskell Chapter 5 Practical Tasks: Improving‐and‐combining‐functions |
This topic explores techniques for improving and combining functions in functional programming. It covers higher-order functions, which take other functions as arguments or return them, including filter for selecting elements and any for checking conditions. Lambda functions provide concise, anonymous function definitions, while precedence and associativity dictate how expressions are evaluated. Curried functions transform multi-argument functions into chains of single-argument functions, and partial application allows fixing some arguments in advance. The $ operator simplifies function application by reducing parentheses, while the . operator enables function composition, combining multiple functions into one. Point-free style further enhances readability by eliminating explicit arguments where possible. Together, these concepts lead to more expressive, reusable, and modular code. |
Open |
2025-03-19 16:32:52 |
4 |
2 |
HC4-4. Haskell Chapter 4 Practical Tasks ‐ Pattern Matching in Functions |
Pattern matching and Case expressions Outline Pattern matching in functions Catch-all patterns Closer look at lists Pattern matching Lists Tuples Case expressions Declaration style VS Expression style Pattern matching Pattern matching is the act of matching data (values, types, etc.) against a pattern, optionally binding variables to successful matches. We are going to discuss pattern matching in three cases: Pattern matching in function definitions. Pattern matching for lists. Pattern matching for tuples. It sounds complicated, but it_SingleQuote_s actually pretty intuitive when you get the hang of it. It_SingleQuote_ll be clear as day after a few examples. Let_SingleQuote_s pattern match some functions! |
Open |
2025-02-05 10:27:29 |
3 |
2 |
HC3-3. Haskell Chapter 3 Conditions-and-helper-constructions |
This Haskell chapter 3 will deal with Conditions-and-helper-constructions. If-then-else expressions in Haskell provide conditional branching but can become cumbersome when multiple conditions are involved. Guards offer a cleaner alternative, allowing multiple conditions to be checked sequentially in a function definition. The `let` expression allows you to define local bindings within an expression, making it useful for temporary calculations, while `where` is used to define local bindings at the end of a function, improving readability. Choosing between `let` and `where` depends on context—`let` is more flexible for inline expressions, whereas `where` keeps function definitions cleaner. Key considerations include readability, scope, and how naturally the code flows. |
Open |
2025-02-02 18:34:28 |
2 |
2 |
HC2-2. Haskell Chapter 2 Practical Tasks - Data types, Signatures and Polymorphism |
These practical task will involve a pragmatic introduction to types, focusing on how Haskell uses a strong, static type system to ensure code safety and correctness. Activities will explore function signatures, understanding how to define and interpret type annotations for functions. By playing with functions, we will experiment with Haskell s pure functions, higher-order functions and composition techniques. Tasks will cover variables in Haskell, emphasizing immutability and how values are bound using let and where expressions. They will differentiate between infix and prefix functions, learning how operators and function applications work in both styles. A deep dive into common data types will help developers understand essential types such as Int, Float, Bool, Char and String. Activities will cover polymorphic values and type variables, demonstrating how Haskell s type system enables code reusability through parametric polymorphism. Finally, activities will cover lists: how to manipulate lists using recursion, pattern matching and built-in functions such as map, foldr and foldl |
Open |
2025-02-03 07:38:29 |
1 |
2 |
HC1-1. Haskell Chapter 1 Practical Tasks |
Haskell is a functional programming language known for its emphasis on pure functions and explicit effects, ensuring code clarity and maintainability. It encourages function composition, allowing developers to build complex operations by combining simpler functions. The Haskell type system is strong and static, providing robust type safety, while laziness (lazy evaluation) ensures computations are performed only when necessary. The language follows a clear and concise syntax, with proper indenting and commenting playing a key role in readability. Developers define and use functions efficiently, leveraging Haskells powerful abstractions. To work with Haskell, essential tools include GHC (Glasgow Haskell Compiler), GHCi (interactive environment), Cabal (package manager), and Stack (build tool), which simplify development and project management |
Open |
2025-02-02 12:34:51 |