Skip to content

Instantly share code, notes, and snippets.

View bitemyapp's full-sized avatar
🐺
aroo

Chris A. bitemyapp

🐺
aroo
View GitHub Profile
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@bitemyapp
bitemyapp / gist:ac316a6eb666695ff7d2
Last active November 4, 2020 04:11
How I talk about Haskell when I want people to care about learning Haskell

Fire up ghci. Make the text real big. Always show the types for everything as you go!

Takes ~1 hour generally.

Note: if you object to "uncertainty" (evocative of data/value flow possibilities), consider wording like "simultaneously possible values". It's a reference to how the compiler won't know whether Maybe a is a Just a or a Nothing statically. Don't blather at me about dependent types; I know.

Alternate verbiage for uncertainty: product - simultaneous altogetherness, sum - simultaneous singlehood. Also consider what the category theoretic diagrams look like. Can be instructive.

Suggestions taken under advisement.

@bitemyapp
bitemyapp / fmap.md
Last active August 29, 2019 13:49 — forked from nkpart/fmap.md

fmap . fmap . fmap

Functors and Traversables compose.

You might have seen this statement before. This is how you can take advantage of it.

Composing many fmap calls gives you a function that will drill down into a structure and modify it at a certain depth in that nested structure.

@bitemyapp
bitemyapp / gist:2ce9ab1ca5564f8db152
Last active December 8, 2018 18:24
Haskell Hatemail lol

From: sanguineempiricist@hushmail.com

Subject: We get it. You learned Haskell and Type theory. Cute.

Nobody gives a shit if any one can do math "in their head". What an outdated fucking analogy.

A) No one considers them good

B) The fact that your post lends so much emphasis to the "doing it all in your head" shows that you are lost in your little world of slight delusion.

@bitemyapp
bitemyapp / redis-yesod.md
Created February 29, 2016 22:23 — forked from MaxGabriel/redis-yesod.md
Connecting to Redis from Yesod

Connecting to Redis from Yesod

This is a quick run-through of how I connected to Redis from a Yesod site (which used the default scaffolding). There isn't much specific to Redis here, so this information should apply to connecting to any database or service from Yesod.

Background: Basics of Hedis

First, a brief intro of the basics of Hedis:

{-# LANGUAGE OverloadedStrings #-}
@bitemyapp
bitemyapp / haskell-app-layers.md
Created January 2, 2018 22:01 — forked from parsonsmatt/haskell-app-layers.md
A basic draft of a future blog post

The question of "How do I design my application in Haskell?" comes up a lot. There's a bunch of perspectives and choices, so it makes sense that it's difficult to choose just one. Do I use plain monad transformers, mtl, just pass the parameters manually and use IO for everything, the ReaderT design pattern, free monads, freer monads, some other kind of algebraic effect system?!

The answer is: why not both/all?

Lately, I've been centering on a n application design architecture with roughly three layers:

Layer 1:

newtype AppT m a = AppT { unAppT :: ReaderT YourStuff m a } deriving ............ The ReaderT Design Pattern, essentially. This is what everything gets boiled down to, and what everything eventually gets interpreted in. This type is the backbone of your app. For some components, you carry around some info/state (consider [MonadMetrics](https://hackage

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

# Install a local copy of Hoogle (OS X, HP)
# Download
cd
cabal unpack hoogle
cd hoogle-4.2.26/
# Build
cabal sandbox init
cabal install -j --dependencies-only

Keybase proof

I hereby claim:

  • I am bitemyapp on github.
  • I am bitemyapp (https://keybase.io/bitemyapp) on keybase.
  • I have a public key whose fingerprint is 81D6 75D8 29F1 8485 FDBD B4E2 5809 8478 C9E4 05E5

To claim this, I am signing this object:

@bitemyapp
bitemyapp / QC.hs
Created March 8, 2018 20:41 — forked from ekmett/QC.hs
Using Quantified Constraints for Optics -- untypechecked (no compiler available)
{-# language TypeInType, QuantifiedConstraints, ConstraintKinds, RankNTypes, UndecidableInstances, MultiParamTypeClasses, TypeFamilies, KindSignatures #-}
module QC where
import Data.Constraint
import Data.Functor.Contravariant
import Data.Kind
import Data.Profunctor
type C = (Type -> Type) -> (Type -> Type -> Type) -> Constraint