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
open import Data.Nat | |
open import Data.Product | |
open import Data.Sum | |
open import Relation.Nullary | |
open import Relation.Binary.PropositionalEquality | |
open import RSC | |
-- Basic data-types |
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 DeriveGeneric #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Position where | |
import GHC.Generics (Generic) | |
import Foreign.Ptr (Ptr ) | |
import Data.Word (Word8) |
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
Debian sid 上の groonga 8.0.2 および Debian jessie 上の groonga 8.0.1 で実験しました。 | |
groonga に投入するクライアントプログラムを中断すると、 | |
それとは関係のない別のクライアントで、JSON の解釈エラーが返ることがある問題があるようです。 | |
問題を再現するスクリプト run.sh を作ることに成功したのでここに貼ります。 | |
( 後輩の前角さんが協力してくれました。ありがとうございます。 ) | |
実行に必要な Debian package は、 | |
groonga, curl です。 | |
run.sh を実行すると、 |
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
import Language.Haskell.TH (nameBase) | |
import Language.Haskell.TH.Name.CamelCase (varCamelcaseName, varName) | |
import Database.Record.TH | |
customConfig :: NameConfig | |
customConfig = | |
defaultNameConfig | |
{ columnName = \tbl col -> varCamelcaseName $ tbl ++ "_" ++ col } | |
main :: IO () |
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
module ExplicitDict where | |
-- explicit type class definition | |
data Mon m = | |
Mon | |
{ mon_op :: m -> m -> m | |
, mon_unit :: m | |
} | |
-- monoid instance of (*, 1) |
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
auto lxc-br | |
iface lxc-br inet static | |
address 172.23.0.1/16 | |
## OUI of PEGATRON CORPORATION is 60:02:92 | |
## lower two bits of first octet is | |
## Global - 0 / Local - 1 bit and Individual - 0 / Group - 1 bit, | |
## so 60 + 2 + 0 == 62 | |
bridge_ports none | |
bridge_hw 62:02:92:11:11:01 | |
bridge_maxwait 0 |
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
type Parser a = String -> [(a, String)] | |
return_ :: a -> Parser a | |
return_ v = \inp -> [(v, inp)] | |
failure :: Parser a | |
failure = \inp -> [] | |
item = \inp -> case inp of | |
[] -> [] |
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
take' :: Int -> [a] -> [a] | |
take' n _ | |
| n <= 0 = [] | |
take' _ [] = [] | |
take' n (x:xs) = x : take' (n - 1) xs -- 先に整数値で場合分け, トップレベルで pattern match | |
take'2 n xxs | |
| n <= 0 = [] | |
| otherwise = case xxs of | |
[] -> [] |
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
import Control.Applicative | |
import Control.Monad | |
import Data.Monoid | |
import Control.Monad.Trans.Except | |
data Exception | |
= IOException String | |
| NoSuchElementException | |
deriving Show |
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
import Prelude hiding (sum) | |
data L1 | |
= F { ($$) :: L1 -> L1 } | |
| V { unV :: Int } | |
infixl 1 $$ | |
instance Show L1 where |