User:Duplode/wb2pdf sandbox
Testing
[edit | edit source]First, let us try a naked pre block:
[[1,2,3,4]]
And a naked parser function:
[[1,2,3,4]]
Then, surrounding pre it with a body note:
Note
[[1,2,3,4]]
Next, HaskellGHCi
[[1,2,3,4]]
Finally, HaskellGHCiExample
Example: A list with a single list
[[1,2,3,4]]
...what about a bare Exercises?
Exercises |
---|
[[1,2,3,4]]
|
Source within box templates
[edit | edit source]Source
Note
Like monads and functors, monoids are a mathematical concept with a corresponding useful Haskell class. We will discuss them in later chapters such as Monoids and MonadPlus. This note is aimed at readers who met monoids before in other contexts; don't worry with it if you had never heard of them until now.
The left and right unit laws of monads are in analogy to the laws for the neutral element of a monoid. Furthermore, the associativity of (>>=)
bind is analogous to the associativity of monoids; even if in the way it was written above it looks a bit different due to the lambda expression, (\x -> f x >>= g)
. The resemblance becomes clearer with the alternative formulation as
(f >=> g) >=> h = f >=> (g >=> h)
where (>=>)
is the equivalent of function composition (.)
for monads and defined as
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
f >=> g = \x -> f x >>= g
pre
Note
Like monads and functors, monoids are a mathematical concept with a corresponding useful Haskell class. We will discuss them in later chapters such as Monoids and MonadPlus. This note is aimed at readers who met monoids before in other contexts; don't worry with it if you had never heard of them until now.
The left and right unit laws of monads are in analogy to the laws for the neutral element of a monoid. Furthermore, the associativity of (>>=)
bind is analogous to the associativity of monoids; even if in the way it was written above it looks a bit different due to the lambda expression, (\x -> f x >>= g)
. The resemblance becomes clearer with the alternative formulation as
(f >=> g) >=> h = f >=> (g >=> h)
where (>=>)
is the equivalent of function composition (.)
for monads and defined as
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c f >=> g = \x -> f x >>= g
Space indent
Note
Like monads and functors, monoids are a mathematical concept with a corresponding useful Haskell class. We will discuss them in later chapters such as Monoids and MonadPlus. This note is aimed at readers who met monoids before in other contexts; don't worry with it if you had never heard of them until now.
The left and right unit laws of monads are in analogy to the laws for the neutral element of a monoid. Furthermore, the associativity of (>>=)
bind is analogous to the associativity of monoids; even if in the way it was written above it looks a bit different due to the lambda expression, (\x -> f x >>= g)
. The resemblance becomes clearer with the alternative formulation as
(f >=> g) >=> h = f >=> (g >=> h)
where (>=>)
is the equivalent of function composition (.)
for monads and defined as
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c f >=> g = \x -> f x >>= g
Nested templates
[edit | edit source]Note
xyz||abc
xyz||abc
A chapter
[edit | edit source]- Haskell/Classes and types
- (tricky) implement a simple Complex data type which is an instance of Num.
- Haskell/Understanding monads/State
- (bonus) implement a random walk simulation.
- Haskell/Understanding monads/List
- implement isGrandparent (see the talk page).
- Haskell/Monad transformers
- Rewrite getValidPassword without using guard.
- Implement a stop-on-failure shell script wrapper with System.Process and MaybeT.
- Write an implementation for ErrorT.
- Combine both kinds of random number generators through the means of StateT/IO
- Collect the generated positions in the random walk simulation with a WriterT/State (or StateT/Writer) combo.
- Haskell/Hierarchical libraries/Arrays
- Complete the tic-tac-toe example from the list monad chapter by implementing a Board type with arrays.
- Misc.
- Write an ironic high-level implementation of a Turing machine.
Trailing whitespace in wikilinks
[edit | edit source]This should point to the chapter above.