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:
I hereby claim:
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 |
{-# 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 |