A: No.
Proof.
Use these definitions
(<&>) :: Functor f => f a -> (a -> b) -> f b| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE PolyKinds #-} | |
| {-# LANGUAGE StandaloneKindSignatures #-} | |
| {-# LANGUAGE GADTs #-} | |
| module CoerceUnder where |
| {-# LANGUAGE DeriveTraqversable #-} | |
| import Witherable | |
| newtype T a = MkT [a] | |
| deriving (Show, Eq, Functor, Foldable, Traversable) | |
| instance Filterable T where | |
| -- ひとつでもNothingがあれば空リスト、 | |
| -- すべてJustならJustを除いた元のリスト | |
| catMaybes tpa = case sequenceA tpa of |
| {-# LANGUAGE DeriveFunctor #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| module Logistic where | |
| import Data.Kind ( Type ) | |
| import Data.Functor.Const | |
| import Data.Functor.Contravariant |
| #!/usr/bin/env cabal | |
| {- cabal: | |
| build-depends: base, vector | |
| -} | |
| module Main where | |
| import Data.Foldable (foldl') | |
| import Control.Monad (guard) | |
| import qualified Data.Vector.Unboxed as V |
https://twitter.com/inamiy/status/1489256068995710976
この記事では、補助的な関数として以下のものを用いる。
-- Special case of Control.Arrow.&&&| {-# LANGUAGE | |
| GADTs, | |
| RankNTypes, | |
| PolyKinds, | |
| DataKinds, | |
| ScopedTypeVariables, | |
| StandaloneKindSignatures | |
| #-} | |
| module DiscreteCategory where |
| #!/usr/bin/env cabal | |
| {- cabal: | |
| build-depends: base, vector, process | |
| -} | |
| module Main where | |
| {- | |
| 検算 |
| $ 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 | |
| 追跡されていないファイル: |
Collection of "would-be co-Applicative" formulations
This article explains Divisible as a co-Applicative