Skip to content

Instantly share code, notes, and snippets.

Chris Done chrisdone

Block or report user

Report or block chrisdone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chrisdone
chrisdone / file-embed-demo.hs
Created Aug 14, 2019
File embed expansion demo
View file-embed-demo.hs
> :set -XOverloadedStrings
> :set -XTemplateHaskell
> import Language.Haskell.TH
> $(bsToExp "Hello, World" >>= stringE . show)
"AppE (VarE GHC.IO.Unsafe.unsafePerformIO) (AppE (AppE (VarE Data.ByteString.Unsafe.unsafePackAddressLen) \
\(LitE (IntegerL 12))) (LitE (StringPrimL [72,101,108,108,111,44,32,87,111,114,108,100])))"
>
> :set -ddump-splices
@chrisdone
chrisdone / cleaner-forms.hs
Last active Aug 12, 2019
forms experimentation type family
View cleaner-forms.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
import Data.Bifunctor
View ShuffleGraph.hs
{-# LANGUAGE ScopedTypeVariables #-}
module Data.Graph.Shuffle where
-- | Shuffle a graph into a randomly sorted list, preserving
-- topological order.
{-
> quickCheckWith stdArgs {maxSuccess=10000} prop_identity
@chrisdone
chrisdone / StableShuffle.hs
Last active Aug 6, 2019
Graph stable shuffle
View StableShuffle.hs
{-# LANGUAGE PartialTypeSignatures #-}
module StableShuffle where
import Control.Monad
import Control.Monad.Random
import Data.Bifunctor
import Data.List
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Ord
View StableShuffle.hs
{-# LANGUAGE PartialTypeSignatures #-}
module StableShuffle where
import Control.Monad
import Control.Monad.Random.Class
import Data.List
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Ord
import System.Random.Shuffle
View amazonka-casa.txt
This file has been truncated, but you can view the full file.
chris@precision:~/Work/chrisdone/prj$ stack build -v
Version 2.2.0, Git revision 896869ee79d82e3bd9bead30d610ac2bf580cd99 (dirty) (7790 commits) PRE-RELEASE x86_64 hpack-0.31.2
2019-07-31 14:16:17.668130: [debug] Checking for project config at: /home/chris/Work/chrisdone/prj/stack.yaml
2019-07-31 14:16:17.668320: [debug] Loading project config file stack.yaml
2019-07-31 14:16:17.674494: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2019-07-30 13:16:17.674439 UTC]
2019-07-31 14:16:17.675171: [debug] Using package location completions from a lock file
2019-07-31 14:16:17.877293: [debug] Asking for a supported GHC version
2019-07-31 14:16:17.877678: [debug] Installed tools:
- ghc-8.2.2
View build-log.txt
chris@precision:~/Work/chrisdone/prj$ stack build -v
Version 2.2.0, Git revision 896869ee79d82e3bd9bead30d610ac2bf580cd99 (dirty) (7790 commits) PRE-RELEASE x86_64 hpack-0.31.2
2019-07-31 13:32:31.396846: [debug] Checking for project config at: /home/chris/Work/chrisdone/prj/stack.yaml
2019-07-31 13:32:31.397084: [debug] Loading project config file stack.yaml
2019-07-31 13:32:31.405902: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2019-07-30 12:32:31.40582 UTC]
2019-07-31 13:32:31.406606: [debug] Using package location completions from a lock file
2019-07-31 13:32:31.568532: [debug] Asking for a supported GHC version
2019-07-31 13:32:31.569087: [debug] Installed tools:
- ghc-8.2.2
- ghc-8.6.3
View TypedNameQuote.hs
{-
> :t $$(named [|| map ||])
$$(named [|| map ||])
:: TypedName
((ghc-prim-0.5.3:GHC.Types.Any -> ghc-prim-0.5.3:GHC.Types.Any)
-> [ghc-prim-0.5.3:GHC.Types.Any]
-> [ghc-prim-0.5.3:GHC.Types.Any])
> $$(named [|| map ||])
TypedName GHC.Base.map
View AesonPreservingKeyOrder.hs
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE CPP #-}
-- | A version of aeson that parses with key order preserved.
--
-- Copyright: (c) 2019 Hasura, Inc.
-- (c) 2011-2016 Bryan O'Sullivan
-- (c) 2011 MailRank, Inc.
module Data.Parser.Json
@chrisdone
chrisdone / GADT_JSON.hs
Last active Jun 28, 2019
Read/write GADTs as JSON
View GADT_JSON.hs
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExtendedDefaultRules #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
You can’t perform that action at this time.