-- m は暗黙に量化されている
{-
action :: forall m. MonadError OutOfRange m => m Int
-}
action :: MonadError OutOfRange m => m Int
action = undefined
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
| -- This exists so that I haven't made a silly mistake, | |
| -- like typo or type mismatch of expressions surrounding equal sign. | |
| {-# LANGUAGE TypeOperators #-} | |
| module Check where | |
| import Prelude hiding (zip) | |
| import Data.These | |
| import Data.Zip | |
| import Data.Bifunctor |
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
| -- https://www.reddit.com/r/haskell/comments/z9eyu7/monthly_hask_anything_december_2022/izpv48z/ | |
| {-# language | |
| DeriveGeneric, | |
| DerivingVia, | |
| StandaloneDeriving, | |
| TypeOperators, | |
| FlexibleInstances, | |
| ScopedTypeVariables, | |
| TypeFamilies, | |
| TypeApplications, |
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 Foldl(foldl', foldl'Copied, foldl'CopiedMono, foldl'Recursion, foldl'Recursion2) where | |
| import Data.List (foldl') | |
| import GHC.Exts (oneShot) | |
| foldl'Copied :: Foldable t => (b -> a -> b) -> b -> t a -> b | |
| {-# INLINE foldl'Copied #-} | |
| foldl'Copied f z0 = \ xs -> foldr (\ (x::a) (k::b->b) -> oneShot (\ (z::b) -> z `seq` k (f z x))) (id::b->b) xs z0 | |
| foldl'CopiedMono :: (b -> a -> b) -> b -> [a] -> b |
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 GADTs, DataKinds #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| module Main where | |
| import Data.Typeable (cast) | |
| import Type.Reflection |
Related to: CoSemigroup and random generator transformers? - r/haskell
class CoSemigroup a where
comult :: a -> (a,a)
comult a = (projL a, projR a)
projL :: a -> a
projL = fst . comult
tはどんな関手 |
とる | 返す | ||
|---|---|---|---|---|
| Traversable t | traverse | Star f a b |
Star f (t a) (t b) |
|
| PTraversable t | ptraverse | p a b |
p (t a) (t b) |
|
| Bitraversable t | bitraverse | Star2 f a₁ a₂ b₁ b₂ |
Star f (t a₁ a₂) (t b₁ b₂) |
|
| Rank2.Traversable t | Rank2.traverse | IxStar f a b |
Star f (t a) (t b) |
|
| traverseBia | $\mathrm |
Collection of "would-be co-Applicative" formulations
This article explains Divisible as a co-Applicative
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
| $ ls | |
| foobar.txt hoge.txt piyo.txt | |
| $ git status | |
| ブランチ main | |
| Changes not staged for commit: | |
| (use "git add <file>..." to update what will be committed) | |
| (use "git restore <file>..." to discard changes in working directory) | |
| modified: hoge.txt | |
| 追跡されていないファイル: |
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
| #!/usr/bin/env cabal | |
| {- cabal: | |
| build-depends: base, vector, process | |
| -} | |
| module Main where | |
| {- | |
| 検算 |