This file contains hidden or 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 DataKinds #-} | |
| {-# LANGUAGE GADTs #-} | |
| module HList.GADT where | |
| import Data.Kind | |
| data HList (ts :: [Type]) where | |
| HNil :: HList '[] | |
| HCons :: forall t ts. t -> HList ts -> HList (t ': ts) |
This file contains hidden or 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 TypeFamilies #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| import Data.Kind | |
| data I a | |
| data X a | |
| data XX |
This file contains hidden or 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
| :{ | |
| let doTH code = do | |
| u <- Data.Unique.newUnique | |
| let decls = "ghciTH_" ++ show (Data.Unique.hashUnique u) | |
| pure $ unlines | |
| [ unwords ["let", decls, "=", code] | |
| , "() = ();" ++ decls | |
| ] | |
| :} |
This file contains hidden or 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
| concat(zipWith replicate [1,2,1,0] "cold") | |
| -- Desugar string literal to [Char] | |
| concat(zipWith replicate [1,2,1,0] ['c', 'o', 'l', 'd']) | |
| -- https://hackage.haskell.org/package/base-4.19.0.0/docs/src/GHC.List.html#zipWith | |
| -- Rewritten to not use the "go" helper, zipWith is: | |
| -- zipWith f [] _ = [] | |
| -- zipWith f _ [] = [] | |
| -- zipWith f (x:xs) (y:ys) = f x y : zipWith f xs ys |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "os/signal" | |
| "sync/atomic" | |
| "syscall" | |
| ) |
This file contains hidden or 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
| dist-newstyle/* | |
| .liquid/* |
This file contains hidden or 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
| # Keep track of build times in a lightweight way | |
| # The log file is based on branch name | |
| function time-log-file() { | |
| echo "$(time-log-dir)/time.$(git rev-parse --abbrev-ref HEAD | sed s#/#--#g).log" | |
| } | |
| function time-log-dir() { | |
| echo "$(git rev-parse --show-toplevel)/.time-logs" | |
| } |
This file contains hidden or 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
| [armando@nixos:~]$ ghci | |
| GHCi, version 9.2.8: https://www.haskell.org/ghc/ :? for help | |
| Loaded GHCi configuration from /home/armando/.ghci | |
| 位 :seti -XDeriveGeneric | |
| 位 import GHC.Generics | |
| 位 data P = P Int Bool String deriving Generic | |
| 位 data S = S1 | S2 | S3 deriving Generic | |
| 位 data R = R { x :: Int, y :: Bool, z :: String } deriving Generic | |
| 位 data SR = S1 { x1 :: Int } | S2 { y2 :: Bool} | S3 { z3 :: String } deriving Generic | |
| 位 :t from |
This file contains hidden or 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 ImportQualifiedPost #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| module MaybeVoidAeson where | |
| import Data.Aeson qualified as Ae | |
| import GHC.Generics | |
| data T a = T { x :: Int, y :: a } deriving Generic |

