This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> create table garbage (`why` enum('are', 'you') not null); | |
Query OK, 0 rows affected (0.16 sec) | |
mysql> insert into garbage values ('mysql'), ('hates'), ('you'); | |
Query OK, 3 rows affected, 2 warnings (0.02 sec) | |
Records: 3 Duplicates: 0 Warnings: 2 | |
mysql> select * from garbage; | |
+-----+ | |
| why | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ImplicitParams #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Lib where | |
data Env = Env { envFoo :: Int, envBar :: String } | |
type App a = (?env :: Env) => IO a | |
someFunc :: IO () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- me | |
skips :: [a] -> [[a]] | |
skips xs = zipWith takeEvery [1..length xs] (repeat xs) | |
takeEvery :: Int -> [a] -> [a] | |
takeEvery n xs | |
| n > length xs = [] | |
| otherwise = xs !! (n-1) : takeEvery n (drop n xs) | |
-- the guy she tells me not to worry about |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compiler-check: match-exact | |
compiler: ghc-8.2.1 | |
resolver: nightly-2017-07-21 | |
setup-info: | |
ghc: | |
windows64: | |
8.2.1: | |
url: https://downloads.haskell.org/~ghc/8.2.1/ghc-8.2.1-x86_64-unknown-mingw32.tar.xz | |
sha1: bdede26c1a2cfcf4ebb08329853d285e32213b3d | |
content-length: 175053796 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Waterfall.Base where | |
import Control.Monad.ST | |
import Data.Foldable (for_) | |
import Data.STRef | |
import qualified Data.Vector.Unboxed as U | |
import qualified Data.Vector.Unboxed.Mutable as MU | |
rainfallBase :: [Int] -> Int | |
rainfallBase xs = sum (zipWith (-) mins xs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ExplicitForAll #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE AllowAmbiguousTypes #-} | |
module TyCon where | |
import GHC.Exts (Constraint) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module Mtl where | |
import Control.Monad.State | |
import Control.Monad.Except | |
runMtl | |
:: Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ stack ghci --package case-insensitive | |
> import Data.CaseInsensitive as CS | |
> :set -XOverloadedStrings | |
> CI.mk "ß" == "SS" | |
True | |
λ> CI.mk "ß" == "ss" | |
True | |
λ> CI.mk "ß" == "s" | |
False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE DataKinds #-} | |
import GHC.TypeLits | |
import Data.Proxy | |
newtype ModList (mod :: Nat) a = ModList { unModList :: [a] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data CheckpointedException | |
= CheckpointedException | |
{ additionalContext :: BugsnagCtx | |
, locations :: NonEmpty Loc | |
, originalException :: SomeException | |
} deriving (Show, Typeable) | |
instance Exception CheckpointedException | |
copyCtxToEvent :: BugsnagCtx -> BugsnagEvent -> BugsnagEvent |