I hereby claim:
- I am dmwit on github.
- I am dmwit (https://keybase.io/dmwit) on keybase.
- I have a public key whose fingerprint is FBCF E1CE 584E 46E2 CEC5 692A 620F C421 171F 63FF
To claim this, I am signing this object:
| import Data.Int | |
| import Data.IntMap (IntMap) | |
| import qualified Data.IntMap as IM | |
| data CellUpdate = CellUpdate | |
| { inputID :: Maybe Int | |
| , offset :: Int8 | |
| } deriving (Eq, Ord, Read, Show) | |
| instance Monoid CellUpdate where mempty = CellUpdate Nothing 0 |
| import Control.Concurrent | |
| import Control.Monad.State | |
| import qualified Data.Map as M | |
| import System.Exit | |
| import XMonad.Core | |
| import XMonad.Operations | |
| import qualified XMonad.StackSet as W | |
| windowIDs :: W.StackSet i l a sid sd -> [a] | |
| windowIDs ss |
| {-# Language | |
| Rank2Types, | |
| GADTs, | |
| DataKinds, | |
| PolyKinds, | |
| TypeFamilies, | |
| DatatypeContexts, | |
| MultiParamTypeClasses, | |
| UndecidableInstances, | |
| UndecidableSuperClasses |
| -- bad: everything in ... is nested | |
| do | |
| v <- foo | |
| case v of | |
| Matches v' -> ... | |
| _ -> throwError "doesn't match" | |
| -- good: ... is not nested | |
| do | |
| v <- foo |
| isSolution w o n e = all isDigit [w,o,n,e] /\ no*won*won == wonewon /\ no != 0 where | |
| no = fromDigits [o,n] | |
| won = fromDigits [n,o,w] | |
| wonewon = fromDigits [n,o,w,e,n,o,w] : [32] | |
| isDigit x = 0 <= x /\ x <= 9 | |
| fromDigits digits = sum [digit * 10^^exp | digit <- digits | exp <- [0...]] |
| {-# LANGUAGE DeriveAnyClass #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| import Generics.Deriving.Monoid | |
| import Generics.Deriving.Semigroup | |
| import GHC.Generics | |
| data Foo = Foo () deriving (Generic, GSemigroup, GMonoid) | |
| instance Semigroup Foo where (<>) = gsappend | |
| instance Monoid Foo where mempty = gmempty |
| data RawDebtRec = RawDebtRec | |
| { company :: Text | |
| , debt :: Int | |
| , phones :: [Int] | |
| } | |
| parseCompany o = o .: "company" | |
| <|> o .: "company" >>= (.: "name") | |
| parseInt o = parseJSON o <|> (read <$> parseJSON o) |
I hereby claim:
To claim this, I am signing this object:
| import Data.Map (Map) | |
| import qualified Data.Map as M | |
| partitionM :: Applicative f => (a -> f Bool) -> [a] -> f ([a], [a]) | |
| partitionM f xs = mconcat <$> traverse inject xs where | |
| inject x = (\b -> ([x | b], [x | not b])) <$> f x | |
| partitions :: Ord a => [a] -> [Map a Integer] | |
| partitions = go 0 where | |
| go _ [] = [M.empty] |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| import Control.Monad.Reader (ReaderT) | |
| import Control.Monad.State (StateT) | |
| import qualified Control.Monad.Reader as R | |
| import qualified Control.Monad.State as S | |
| class Monad m => DmwitMonadReader m where | |
| type Env m | |
| type Wrapped m :: * -> * |