Skip to content

Instantly share code, notes, and snippets.

View igrep's full-sized avatar
:shipit:
Writing in Haskell, TypeScript, or Power Automate

YAMAMOTO Yuji igrep

:shipit:
Writing in Haskell, TypeScript, or Power Automate
View GitHub Profile
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
@igrep
igrep / stack-setup-info.yaml
Created April 29, 2019 11:15
GHC 8.8.1-alpha1 for stack
ghc:
macosx:
8.8.0.20190424:
url: https://downloads.haskell.org/ghc/8.8.1-alpha1/ghc-8.8.0.20190424-x86_64-apple-darwin.tar.xz
sha256: 563e34bb2d8a48fa5630136c5acc059bab0e807bf4f02b23d0fbc75f38500feb
windows64:
8.8.0.20190424:
url: https://downloads.haskell.org/ghc/8.8.1-alpha1/ghc-8.8.0.20190424-x86_64-unknown-mingw32.tar.xz
sha256: 1b5ff7995a07e7251b26b3c7dadba57906b7e6d236d0e94c4e92d9b5b8ee3300
@igrep
igrep / git-use-flow.svg
Last active February 8, 2019 05:51
前職時代、Gitの利用方法を同僚に教えるために作った、Gitを利用する際のフロー
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@igrep
igrep / save-enexs.ps1
Last active January 7, 2019 23:32
Export notes in evernote by date
Set-PSDebug -trace 2
$FORMAT = "yyyy-MM-dd"
$QUERY_FORMAT = "yyyyMMdd"
$since = [DateTime]::ParseExact($args[0], $FORMAT, $null)
$until = if ($args[1]) {
[DateTime]::ParseExact($args[1], $FORMAT, $null)
} else {
@igrep
igrep / associative-law.hs
Created December 19, 2018 06:28
(HAS TYPE ERROR) Test associative law for type-level append (++)
#!/bin/env stack
{-
stack --resolver=lts-12.24 script --package extensible
-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
import Data.Extensible
class Parser
attr_reader :value
def initialize string, value = nil
@string = string
@value = value
end
def self.eval string
self.new(string).expr.value
@igrep
igrep / givens-sample.hs
Created July 13, 2018 07:40
Usage plan of Givens Testing Library: More RSpec-like testing library in Haskell.
describe "example group" $ do
-- Equivalent with RSpec's `let!(:hoge){ 1 }`.
-- An action passed to `given` function is executed every time
-- an example (defined by `it`) in the `describe` block is executed,
-- then the action's result is cached until the example's execution completes.
hoge <- given $ return 1
-- Equivalent with RSpec's `let(:hoge){ 1 }` (without exclamation).
hogeIfNecessary <- givenIfNecessary $ runOnlyIfReferred
@igrep
igrep / .local.vimrc
Created June 27, 2018 04:48
workaround of bug of Neoformat for Windows https://github.com/sbdchd/neoformat/issues/169
let g:neoformat_haskell_mystylishhaskell = {
\ 'exe': 'stylish-haskell',
\ 'args': ['2>nul'],
\ 'stdin': 1,
\ }
let g:neoformat_enabled_haskell = ['mystylishhaskell']
augroup fmt
autocmd!
autocmd BufWritePre *.hs undojoin | Neoformat mystylishhaskell
augroup END
@igrep
igrep / without.hs
Last active May 28, 2018 01:12
without function for Record in extensible package
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
@igrep
igrep / parser-oo.rb
Created May 19, 2018 05:00
Arithmetic expression parser *without* StringScanner in Ruby, inspired by parser combinators.
class Parser
def initialize string
@string = string
# To improve performance, increments position instead of modifying @string.
@position = 0
end
def self.eval string