Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Mizunashi Mana mizunashi-mana

💭
I may be slow to respond.
Block or report user

Report or block mizunashi-mana

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
@mizunashi-mana
mizunashi-mana / ExceptionUtil.hs
Created May 28, 2019
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:
View StateVSIORef.hs
{-# LANGUAGE LambdaCase #-}
module Bench.StateVSIORef where
import Data.IORef
import Data.IORef.Unboxed
import Control.Monad.State.Strict
n :: Int
View StateVSIORef.hs
{-# LANGUAGE LambdaCase #-}
module Bench.StateVSIORef where
import Data.IORef
import Control.Monad.State.Strict
n :: Int
n = 2 ^ (31 :: Int)
View StateVSIORef.hs
module Bench.StateVSIORef where
import Data.IORef
import Control.Monad.State.Strict
n :: Int
n = 10000 * 10000
rotate :: [a] -> [a]
View NaiveParser.hs
module NaiveParser where
import Control.Monad
import Data.Maybe (fromMaybe)
import Text.ParserCombinators.Parsec
data Block = List [Block] | ListItem String
deriving Show
You can’t perform that action at this time.