http://qiita.com/advent-calendar/2015/vim-script
記念すべき世界初のVim script Advent Calendar記事です。
本記事はたったひとつの大事なことだけ述べます。
http://qiita.com/advent-calendar/2015/vim-script
記念すべき世界初のVim script Advent Calendar記事です。
本記事はたったひとつの大事なことだけ述べます。
-- interface is a more familiar name for the intention of the construct | |
type alias Append a rest = { rest | append : a -> a -> a} | |
-- implement is a more familiar name | |
stringAppend rest = {rest | append = \x y -> x ++ y} | |
-- this is Monoid | |
type alias AppendWithId a rest = Append a {rest | id : a} | |
-- ^ 1 potential superclass |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Concurrent (threadDelay) | |
import Control.Lens | |
import Control.Monad.IO.Class (liftIO) | |
import Control.Monad.State | |
import Data.List (nub, isPrefixOf) | |
import Data.Text.Lazy.Encoding (decodeUtf8) | |
import Data.Text.Lens (unpacked) | |
import qualified Network.Wreq as Wreq |
# Load | |
Split-Path $MyInvocation.MyCommand.Path -Parent | Push-Location | |
Get-ChildItem poco_*.ps1 | %{. $_} | |
Pop-Location | |
function Select-Poco | |
{ | |
Param | |
( | |
[Object[]]$Property = $null, |
compiler: ghc-8.2.0.20170507 | |
compiler-check: match-exact | |
resolver: lts-8.13 | |
setup-info: | |
ghc: | |
linux64: | |
8.2.0.20170507: | |
url: https://downloads.haskell.org/~ghc/8.2.1-rc2/ghc-8.2.0.20170507-x86_64-deb8-linux.tar.xz | |
content-length: 141011788 | |
sha1: ff886437c1d2ddfa5686d6c9efb0819a957c3dde |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} |
上に行くほど強い
(例えば「休日でなく、かつ大規模イベントと被っている日」はx
)
JSONは NaN
/ Infinity
/ -Infinity
や Date
型等に対応していない。
しかし、JavaScriptのJSONは、これらを解消する仕組みを持っている。
それは JSON.parse
の第二引数の reviver
とJSON.stringify
の第二引数の replacer
だ。
注意が必要なのは、 Date
型は toJSON
メソッドを持つため replacer
に値が渡る前に文字列になってしまうこと。
これに対応するには toJSON
メソッドを一時退避してしまえば良い。
これらを上手く駆使すれば、JSONに型を保ったまま値を保存し復元することができる。