Skip to content

Instantly share code, notes, and snippets.

View isovector's full-sized avatar

Sandy Maguire isovector

View GitHub Profile
@chshersh
chshersh / TypeError.hs
Last active July 15, 2019 06:53
Examples of custom type errors
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
@Lysxia
Lysxia / GadtRead.hs
Created May 15, 2019 22:10
Generic parser for GADT with kind-generics
{-# LANGUAGE
AllowAmbiguousTypes,
TypeApplications,
ScopedTypeVariables,
GADTs,
DataKinds,
PolyKinds,
FlexibleContexts,
FlexibleInstances,
MultiParamTypeClasses,
@schell
schell / haskell-games.md
Last active October 1, 2018 21:28
haskellgames.com

what is it

The idea is to host haskell implementations of popular console/arcade titles as a blog series. The end goal being to ignite interest in writing games with haskell and possibly hosting a haskell game jam at some point in the future. For launch it would be nice to have 3-4 games already written.

Getting this off the ground is going to take a long time as my (schell's) free time is pretty limited ATM, so don't worry if you feel like committing to this is too much. You can commit any amount of time and write your game slowly as I figure out the details.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KingoftheHomeless
KingoftheHomeless / Mo.hs
Last active November 15, 2018 20:42
The monad-to-comonad transformer
{-# LANGUAGE RankNTypes, GADTs #-}
module Mo where
import Control.Comonad
import Control.Comonad.Trans.Class
import Control.Monad
{-
The monad-to-comonad transformer.
Originally, Mo was defined as the simpler (and isomorphic):
data Mo m w a where
@Lysxia
Lysxia / hkd-apply.hs
Created April 3, 2018 00:00
HKD deriving ToJSON by encoding quantified constraints
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
@Icelandjack
Icelandjack / TF_QC.md
Last active September 23, 2022 16:10
(#14860) QuantifiedConstraints: Can't quantify constraint involving type family

For the Trac ticket #14860.

All these types are valid for h, but its principal type involves -XQuantifiedConstraints

{-# Language FlexibleInstances, MultiParamTypeClasses, GADTs, QuantifiedConstraints #-}

import Data.Kind

type family FB (a::Type) (b::Type) :: Type where
@tobert
tobert / LinuxMIDISynth.md
Created November 28, 2017 23:31
MPKmini2 MIDI + fluidsynth CLI only

Akai MPK Mini 2 + Fluidsynth + Linux synthesizer

This is a quick & dirty way to attach an Akai MPK mini 2 USB MIDI controller to Linux so the Linux machine can act as its synthesizer. This approach should work for any modern USB MIDI instrument.

Rationale

I looked around on the web and, surprisingly, I didn't find any simple options for quickly starting Fluidsynth up and wiring it to a MIDI controller for simple keyboard usage. There are a few out there that involve using Qsynth which is cool but I didn't want a GUI for something relatively simple.

Shell Session

@kennwhite
kennwhite / 1944_OSS_Simple_Sabotage_Field_Manual.md
Last active April 5, 2024 02:51
1944 OSS Simple Sabotage Field Manual
@Icelandjack
Icelandjack / Constraints.org
Last active April 2, 2024 20:22
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.