Commit graph

14 commits

Author SHA1 Message Date
William Carroll
0c71fc9d1d Drop support for dir-locals.nix, <nixpkgs>, etc.
In the spirit of Marie Kondo, I'm tidying up!

TL;DR:
- Prefer .envrc `use_nix` and delete all dir-locals.nix files
- Remove ~all references to <nixpkgs>, <unstable>, <depot> and prefer
  referencing each with briefcase.third_party.{pkgs,unstable,depot}
- Delete nixBufferFromShell function since I was only using that in
  dir-locals.nix files
2020-08-20 11:26:32 +01:00
William Carroll
a2475d2337 Partially complete IO chapter exercises
Inconveniently, I do not have the cipher code that I wrote from a previous
chapter, and I'm not eager to reimplement it.

TODO
- Implement encrypt
- Implement decrypt
- Read all characters from STDIN
2020-07-17 23:41:03 +01:00
William Carroll
0f1146cc4c Partially complete the "Basic Libraries" chapter exercises
I was instructed to benchmark these functions, but I couldn't get the
benchmarking library to run using Nix -- although I'm *sure* it's
possible. Unfortunately the book recommends using `stack`, which I couldn't
reproduce.
2020-07-17 11:39:44 +01:00
William Carroll
feb74b3091 Complete exercises for "Non-Strictness" chapter
I completed most of the exercises for this enlightening chapter in ghci.
2020-07-14 22:28:24 +01:00
William Carroll
e5abc3d675 Finish exercises for Monad Transformer chapter
I expect to look back on this code and cringe, but... it compiles!
2020-07-12 22:43:29 +01:00
William Carroll
5116cc3463 Partially complete Monad Transformer exercises
Write Functor, Applicative, Monad instances for:
- MaybeT
- EitherT
- ReaderT
2020-07-12 17:40:54 +01:00
William Carroll
3665ea457b Partially complete some of the exercises for Composing Types
I believe there are two exercises sets in the "Composing Types" chapter. Here
are *some* of my answers so far...

I'm having trouble implementing Foldable for Compose. I was able to implement a
version of it by adding the (Functor f) constraint to the instance signature,
but I think I cheated.

I will revisit these problems as well as the earlier exercises later.
2020-07-11 11:25:07 +01:00
William Carroll
ee1aeee5f8 Complete exercises for Reader and State chapters
It's beautiful how State is just Reader that returns a tuple of (a, r) instead
of just a, allowing you to modify the environment (i.e. state).

```haskell
newtype Reader r a = Reader { runReader :: r -> a }
newtype State s a = State { runState :: s -> (a, s) }
```
2020-07-01 10:42:57 +01:00
William Carroll
c4fe3c92c7 Create a .ghci for this directory
I would've created on at $HOME/.ghci, but I don't need that yet, and I didn't
want to bother with home-manager.
2020-07-01 10:38:56 +01:00
William Carroll
d820898de5 Complete exercises from Traversable chapter
I feel much more comfortable using `traverse` and `sequenceA`. I even used both
of them in the Haskell program that I wrote at work to export a trix.
2020-07-01 10:37:54 +01:00
William Carroll
362a31166d Create Nix shell for Haskell scratchpad
Helps me run my chapter exercises.
2020-06-18 11:08:55 +01:00
William Carroll
a981bb0d4a Complete the Monad chapter
From "Haskell Programming from First Principles"...

I have completed all of the exercises in the book thus far, but I only recently
dedicated a Haskell module for each chapter. Previously I created ad hoc modules
per exercise, per chapter... it was chaotic.
2020-06-18 11:07:55 +01:00
William Carroll
71e79f5f5d Complete exercises from Applicative chapter
From "Haskell Programming from First Principles"...
2020-06-18 11:07:03 +01:00
William Carroll
406764f552 Complete exercises from Foldable chapter
I'm creating Haskell modules to host my attempts and solutions for the exercises
defined in each chapter of "Haskell Programming From First Principles".
2020-06-18 11:05:49 +01:00