Skip to content

Instantly share code, notes, and snippets.

日比野 啓 (Kei Hibino) khibino

Block or report user

Report or block khibino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@khibino
khibino / WithPlaceholder.hs
Created May 10, 2019
with placeholder example
View WithPlaceholder.hs
{-# LANGUAGE FlexibleInstances #-}
import Data.DList
import Control.Monad.Trans.Writer (Writer)
import Data.Functor.ProductIsomorphic
data PH a = PH
newtype WithPhT r a =
WithPhT { runWithPhT :: Writer (DList Int) (r a) }
View IpState.agda
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
View Position.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
module Position where
import GHC.Generics (Generic)
import Foreign.Ptr (Ptr )
import Data.Word (Word8)
View report.txt
Debian sid 上の groonga 8.0.2 および Debian jessie 上の groonga 8.0.1 で実験しました。
groonga に投入するクライアントプログラムを中断すると、
それとは関係のない別のクライアントで、JSON の解釈エラーが返ることがある問題があるようです。
問題を再現するスクリプト run.sh を作ることに成功したのでここに貼ります。
( 後輩の前角さんが協力してくれました。ありがとうございます。 )
実行に必要な Debian package は、
groonga, curl です。
run.sh を実行すると、
@khibino
khibino / name-config.hs
Created Mar 19, 2018
Name configuration example of Haskell Relational Record
View name-config.hs
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 ()
View ExplicitDict.hs
module ExplicitDict where
-- explicit type class definition
data Mon m =
Mon
{ mon_op :: m -> m -> m
, mon_unit :: m
}
-- monoid instance of (*, 1)
View interfaces.example
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
View parser.hs
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
[] -> []
View take.hs
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
[] -> []
View j.hs
import Control.Applicative
import Control.Monad
import Data.Monoid
import Control.Monad.Trans.Except
data Exception
= IOException String
| NoSuchElementException
deriving Show
You can’t perform that action at this time.