- http://bitemyapp.com/posts/2017-09-23-please-stop-using-typed-holes.html
- http://vaibhavsagar.com/blog/2017/05/22/discovering-continuations/
- http://matthew.brecknell.net/post/hole-driven-haskell/
- https://www.youtube.com/watch?v=52VsgyexS8Q
- https://wiki.haskell.org/GHC/Typed_holes
- https://github.com/maddogdavis/holey
- https://ghc.haskell.org/trac/ghc/wiki/Holes
- https://www.shimweasel.com/2015/02/17/typed-holes-for-beginners
A guide to setting up the Haskell tooling for Emacs in a Nix environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Payments where | |
data Customer = Customer { name :: String, age :: Int } deriving (Eq, Ord, Show) | |
-- I know partial record fields is an anti-pattern, but who's counting? | |
data Payment | |
= Cash { customer :: Customer, amount :: Double } | |
| Credit { customer :: Customer, amount :: Double, cardNumber :: Int } | |
| Check { customer :: Customer, amount :: Double, routingNumber :: Int, accountNumber :: Int } | |
deriving (Eq, Ord, Show) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LAnguage FlexibleInstances #-} | |
{-# LANGuage FunctionalDependencies #-} | |
{-# LANGUAge GADTs #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module Trolling where | |
--------------------------------------------------------------------- | |
-- VARIADIC COMPOSITION IN HASKELL (A LA RAMDA.JS). | |
-- | |
-- In Haskell, we typeically think of the composition operator (or |
This gist demonstrates a trick I came up with which is defining
IsString
for Q (TExp a)
, where a
is lift
-able. This allows you
to write $$("...")
and have the string parsed at compile-time.
On GHC 9, you are able to write $$"..."
instead.
This offers a light-weight way to enforce compile-time constraints. It's
basically OverloadedStrings
with static checks. The inferred return type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Importance of category theory | |
* Answers the question: "What is a *timeless* API?" | |
* What does "timeless" mean? | |
* Likely to still be relevant years from now | |
* Likely to be low maintenance (since unlikely to change) | |
* Less likely to be subject to controversy or discussion ("obvious") | |
* Examples: | |
* Everything Haskell's typeclassopedia (except maybe `Foldable`) | |
* Categories / Monoids | |
* `(.)` / `id` |
OlderNewer