Skip to content

Instantly share code, notes, and snippets.

Avatar

Sandy Maguire isovector

View GitHub Profile
@isovector
isovector / Main.hs
Last active Jun 24, 2020
eta reduction repro
View Main.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE PatternSynonyms #-}
module Main where
import GHC.Generics
import Data.Void
import Control.Applicative
import Control.Arrow
import Control.Monad.Trans.State
View api.hs
-- I am designing an API. This is not real haskell code, but it is accepted by my tool.
-- I can define type sigs as usual
query :: Query a -> System -> [a]
-- I can also write laws that the eventual implementation must satisfy.
-- lines that begin with a string are laws.
-- notice that these are _not even_ haskell definitions, because the LHS is not a pattern.
"1" queryEntity ix (refine (const False) q) s = Nothing
"2" queryEntity ix (refine (const True) q) = queryEntity ix q
View denotations.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
module Deno where
import Control.Applicative
import Test.QuickCheck.Checkers
import Test.QuickCheck.Classes
import Test.QuickCheck
@isovector
isovector / Main.hs
Last active Feb 9, 2020
Design and Interpretation
View Main.hs
-- The actual IO implementation of the program
withFreenode :: (Handle -> IO a) -> IO a
withFreenode f =
runTCPClient "irc.freenode.net" "6667" $ \sock -> do
irc <- socketToHandle sock ReadWriteMode
hSetBuffering irc LineBuffering
f irc <* hClose irc
View gist:4328b3bf38e00317c3305b2df8a25dab
Tue Aug 27 19:56 2019 Time and Allocation Profiling Report (Final)
ghc.exe +RTS -p -RTS Main.hs --make -O -fforce-recomp
total time = 7.72 secs (7721 ticks @ 1000 us, 1 processor)
total alloc = 9,747,651,160 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
simplIdF Simplify compiler\simplCore\Simplify.hs:899:61-79 16.9 18.1
View pos.bash
$ _build/stage0/bin/ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage1/lib/package.conf.d' '-package-id array-0.5.3.0' '-package-id base-4.12.0.0' '-package-id bytestring-0.10.8.2' '-package-id containers-0.6.0.1' '-package-id deepseq-1.4.4.0' '-package-id directory-1.3.3.0' '-package-id filepath-1.4.2.1' '-package-id ghc-8.6.5' '-package-id ghc-boot-8.6.5' '-package-id ghci-8.6.5' '-package-id haskeline-0.7.4.3' '-package-id process-1.6.5.0' '-package-id time-1.8.0.2' '-package-id transformers-0.5.6.2' '-package-id unix-2.7.2.2' -i -i_build/stage1/ghc/build -i_build/stage1/ghc/build/ghc/autogen -ighc/. -Iincludes -I_build/generated -I_build/stage1/ghc/build -I/home/sandy/prj/ghc/_build/stage1/lib/x86_64-linux-ghc-8.6.5/ghc-8.6.5/include -I/home/sandy/prj/ghc/_build/stage1/lib/x86_64-linux-ghc-8.6.5/process-1.6.5.0/include -I/home/sandy/prj/ghc/_build/stage1/lib/x86_64-linux-ghc-8.6.5/unix-2.7.2.2/include -I/home/sandy/prj/ghc/_build/stage1/lib/x86_
View stack.log
Version 2.1.1, Git revision f612ea85316bbc327a64e4ad8d9f0b150dc12d4b (7648 commits) x86_64 hpack-0.31.2
2019-08-18 14:57:19.353880: [debug] Checking for project config at: /home/sandy/prj/dynahaskell/stack.yaml
2019-08-18 14:57:19.354185: [debug] Loading project config file stack.yaml
2019-08-18 14:57:19.373019: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2019-08-17 20:57:19.372901643 UTC]
2019-08-18 14:57:19.373875: [debug] Using package location completions from a lock file
2019-08-18 14:57:19.928754: [debug] Running hpack on /home/sandy/prj/dynahaskell/package.yaml
2019-08-18 14:57:19.939843: [debug] hpack output unchanged in /home/sandy/prj/dynahaskell/dynahaskell.cabal
2019-08-18 14:57:19.942990: [debug] Completing package location information from chiasma-0.1.0.0@sha256:0d95d24746716430eca2d54755384e7f0da8c6cac4f4171705f47ff7c907ba87,2472
2019-08-18 14:57:19.943932: [debug] Completing package location information from posix-pty-0.
@isovector
isovector / code.gs
Created Jul 7, 2019 — forked from zhenyanghua/code.gs
Googlemaps + Google Sheets + Google Forms
View code.gs
var SPREADSHEET_ID='Google Sheets ID';
var SHEET_NAME = 'Google Sheets Table Name';
function doGet(request) {
var callback = request.parameters.jsonp;
var range = SpreadsheetApp.openById(SPREADSHEET_ID).getSheetByName(SHEET_NAME).getDataRange();
var json = callback+'('+Utilities.jsonStringify(range.getValues())+')';
return ContentService.createTextOutput(json).setMimeType(ContentService.MimeType.JAVASCRIPT);
}
@isovector
isovector / error.hs
Created May 27, 2019
inspection-testing
View error.hs
LHS:
recursive
:: forall (e :: (* -> *) -> * -> *) s (r :: [(* -> *)
-> * -> *]) a.
(forall x (m :: * -> *). e m x -> StateT s (Sem r) x)
-> s -> Sem (e : r) a -> Sem r (s, a)
recursive = recursive
recursive_s9LZ
:: forall (e :: (* -> *) -> * -> *) s (r :: [(* -> *)
View T16473.dump-simpl
==================== Tidy Core ====================
2019-03-26 16:42:16.733069541 UTC
Result size of Tidy Core
= {terms: 572, types: 1,423, coercions: 358, joins: 0/6}
-- RHS size: {terms: 5, types: 17, coercions: 9, joins: 0/0}
$WUnion :: forall (e :: * -> *) a. e a -> Union '[e] a
$WUnion
You can’t perform that action at this time.