Skip to content

Instantly share code, notes, and snippets.

View mizunashi-mana's full-sized avatar
💭
I may be slow to respond.

Mizunashi Mana mizunashi-mana

💭
I may be slow to respond.
View GitHub Profile
@mizunashi-mana
mizunashi-mana / sizeclasses.go
Created July 2, 2023 10:12
Size classes of Golang on aarch64
View sizeclasses.go
// Code generated by mksizeclasses.go; DO NOT EDIT.
//go:generate go run mksizeclasses.go
package runtime
// class bytes/obj bytes/span objects tail waste max waste min align
// 1 8 8192 1024 0 87.50% 8
// 2 16 8192 512 0 43.75% 16
// 3 24 8192 341 8 29.24% 8
// 4 32 8192 256 0 21.88% 32
@mizunashi-mana
mizunashi-mana / list.qq
Created February 20, 2020 13:38
List 関数群の例
View list.qq
module List where
type List : Type -> Type
data List where
Nil : List a
Cons : a -> List a -> List a
type String : Type
type String = List Char
@mizunashi-mana
mizunashi-mana / Fib.qq
Created January 12, 2020 10:34
An idea of new programming language
View Fib.qq
module Main where
dict Integral a = Integral {
fromInteger: Integer -> a,
+: a -> a -> a,
-: a -> a -> a,
iszero: a -> Bool,
}
impl integralForInteger: Integral Integer
View BitSeq.hs
module BitSeq where
merge :: Int -> [a] -> [a] -> [a]
merge n xs ys = goXs n xs
where
goXs 0 zs = goYs n ys zs
goXs m (z:zs) = z:goXs (m - 1) zs
goXs _ [] = error "unreachable"
goYs 0 zs r = merge (n + 1) r zs
@mizunashi-mana
mizunashi-mana / ExceptionUtil.hs
Created May 28, 2019 06:27
try で複数の例外をキャッチしたい場合
View ExceptionUtil.hs
{-# LANGUAGE GADTs #-}
module Control.ExceptionUtil where
import Control.Exception
data TrySelection a where
TrySelection :: Exception e => (e -> a) -> TrySelection a
trySelectionBuilder :: [TrySelection a] -> SomeException -> Maybe a
View MayBreakDerivingVia.hs
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE StandaloneDeriving #-}
module MayBreakDerivingVia where
import Control.Monad.Trans.Reader
newtype T m a = T (Int -> m a)
View PointerRepr.hs
{-# LANGUAGE MagicHash #-}
module Main where
import Unsafe.Coerce
import GHC.Exts
data CompactD = CA | CB | CC
deriving (Show)
View NotSpaceAsciiString.hs
module TestSpace.NotSpaceAsciiString where
import Test.QuickCheck.Arbitrary
import Test.QuickCheck.Gen
import Data.Coerce
import Data.Char (isSpace)
newtype NotSpace = NotSpace Char
deriving (Eq, Ord, Show)
View FoldlStrictness.hs
{-# LANGUAGE BangPatterns #-}
module Main where
import Criterion.Main
import Control.DeepSeq
import Data.Foldable
{-
Result: