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
#!/usr/bin/env cabal | |
{- cabal: | |
build-depends: base, mtl, containers, uniplate | |
ghc-options: -Wall | |
-} | |
-- | An example of a kind inference for data types using | |
-- unification-based constraint solving. | |
-- |
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
#!/usr/bin/env cabal | |
{- cabal: | |
build-depends: base, mtl, containers, uniplate | |
ghc-options: -Wall | |
-} | |
-- | An example of a kind inference for data types using | |
-- unification-based constraint solving. | |
-- | |
-- See the blog post: |
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
{-# options_ghc -Wall #-} | |
{-# language LambdaCase #-} | |
-- | Run repl with: | |
-- | |
-- > cabal repl --build-depends containers --build-depends mtl | |
-- | |
-- or | |
-- | |
-- > stack exec --package containers --package mtl -- ghci |
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 OverloadedStrings #-} | |
module Main (main) where | |
import Web.Scotty | |
import Control.Monad.IO.Class | |
import Network.Wai.Middleware.RequestLogger | |
import Network.Wai.Middleware.Static | |
import Network.Wai.Parse |
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
5,249,078,184 bytes allocated in the heap | |
234,375,952 bytes copied during GC | |
9,022,600 bytes maximum residency (8 sample(s)) | |
1,733,392 bytes maximum slop | |
24 MiB total memory in use (0 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 5100 colls, 0 par 0.323s 0.328s 0.0001s 0.0005s | |
Gen 1 8 colls, 0 par 0.020s 0.020s 0.0025s 0.0056s |
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 Main (main) where | |
import Control.Monad (forever, unless) | |
import qualified Data.ByteString.Char8 as C | |
import Network.Socket | |
import Network.Run.TCP (runTCPClient) | |
import Network.Socket.ByteString (recv, sendAll) | |
import System.IO (hFlush, stdout) | |
main :: 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
{-# LANGUAGE ViewPatterns, TupleSections #-} | |
import qualified Data.Map as M | |
import qualified Data.Set as S | |
import qualified Data.Sequence as Seq | |
import Control.Monad.Except | |
type User = String | |
type From = User | |
type To = User |
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
#!/bin/bash | |
if [ ! -f ~/.local/bin/ghc ]; then | |
echo '#!/bin/bash' > ~/.local/bin/ghc; | |
echo 'stack exec -- ghc $@' >> ~/.local/bin/ghc; | |
chmod +x ~/.local/bin/ghc; | |
echo "~/.local/bin/ghc created." | |
else | |
echo "~/.local/bin/ghc already exists." | |
fi |
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
#!/usr/bin/env stack | |
-- stack --resolver lts-15.7 script --package text --package process | |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Monad | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as T | |
import System.Process |
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 exec --package uniplate --package criterion -- ghc Plate.hs -O2 -ddump-simpl -dsuppress-all > /tmp/Plate-dump.hs | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE LambdaCase #-} | |
import GHC.Generics | |
import Transform | |
data Expr |
NewerOlder