Skip to content

Instantly share code, notes, and snippets.

View ftzm's full-sized avatar

Matthew Fitzsimmons ftzm

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ftzm on github.
  • I am ftzm (https://keybase.io/ftzm) on keybase.
  • I have a public key ASClWSoSMhva1QIZwN23yNO6Bqj2mE_S4Z1RKvgIsqfRtQo

To claim this, I am signing this object:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE FlexibleContexts #-}
module HKD where
import GHC.Generics
import Data.Generic.HKD
-- SELECT to_json(cc)
-- FROM (
-- SELECT
-- c.name,
-- COALESCE(array_agg(i) FILTER(WHERE i.name IN ('gin')), '{}') AS matches,
-- COALESCE(array_agg(i) FILTER(WHERE i.name NOT IN ('gin')), '{}') AS missing
-- FROM cocktails as c
-- JOIN ingredient_use as iu ON iu.cocktail_id = c.id
-- JOIN ingredients as i ON i.id = iu.ingredient_id
-- GROUP BY c.id, c.name
@ftzm
ftzm / Test.hs
Last active May 31, 2022 12:38
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeApplications #-}
module Test where
import Control.Monad.Reader
import Data.Generics.Product.Typed
module HeterogenousMapLookup where
data FactorOne = FactorOneA | FactorOneB deriving (Eq, Ord)
data FactorTwo = FactorTwoA | FactorTwoB deriving (Eq, Ord)
data Tariff = Tariff
{ factorOne :: FactorOne
, factorTwo :: FactorTwo
} deriving Generic