https://twitter.com/lotz84_/status/1787796266484908211
lotz @lotz84_
これを書いていて Vector n a 同士の sequenceA が distribute のように振る舞うのが気になった👀 一般に Traversable の distribute が Distributive の sequenceA に一致することが則を使って言えないだろうか?🤔 QuickCheck で少し探してみたけど反例はなさそう
https://twitter.com/lotz84_/status/1787796266484908211
lotz @lotz84_
これを書いていて Vector n a 同士の sequenceA が distribute のように振る舞うのが気になった👀 一般に Traversable の distribute が Distributive の sequenceA に一致することが則を使って言えないだろうか?🤔 QuickCheck で少し探してみたけど反例はなさそう
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TypeOperators, NoStarIsType #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# OPTIONS_GHC -fplugin GHC.TypeLits.Normalise #-} | |
{-# OPTIONS_GHC -fplugin GHC.TypeLits.KnownNat.Solver #-} | |
module Sing where | |
import qualified Data.Singletons.Prelude as S |
See also List of materials about Software Design in Haskell
Junior | Middle | Senior | Architect | |
---|---|---|---|---|
Haskell level | Basic Haskell | Intermediate Haskell | Advanced Haskell | Language-agnostic |
Haskell knowledge scope | Learn you a Haskell | Get programming with Haskell | Haskell in Depth | Knows several languages from different categories |
Get programming with Haskell | Haskell in Depth | Functional Design and Architecture | ||
Soar with Haskell | [Soar |
Lately I have been busy reading some new books on Domain Driven Design (DDD) and software architecture -- including a short yet eye-opening one in Python and a great one in F#. At the same time, it seems that more people in the Functional Programming world are looking at more formal approaches to modelling -- some examples here. This has brought some thought from the background of my brain about how we should model, organize, and architect software using the lessons we've learnt from functional programming.
Before moving on, let me be clear about this being just a dump of some thoughts, not always well-defined, definite
The following are appendices from Optics By Example, a comprehensive guide to optics from beginner to advanced! If you like the content below, there's plenty more where that came from; pick up the book!
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE UnsaturatedTypeFamilies #-} | |
import GHC.TypeLits | |
import Prelude hiding (Functor, Semigroup) | |
type Main = (Fizz <> Buzz) <$> (0 `To` 100) |
module NumberPlate where | |
import Data.List | |
data Cell = Cell {num :: Int, row :: Int, col :: Int, block :: Int} deriving Eq | |
data Tree = Node Board [Tree] deriving Show | |
type Board = [Cell] | |
type Ploblem = [Int] | |
instance Show Cell where |
-- https://www.reddit.com/r/haskell/comments/abxem5/experimenting_with_kleisli_instance_of/ | |
{-# Language TypeApplications #-} | |
{-# Language RankNTypes #-} | |
{-# Language DataKinds #-} | |
{-# Language KindSignatures #-} | |
{-# Language PolyKinds #-} | |
{-# Language TypeOperators #-} | |
{-# Language GADTs #-} | |
{-# Language TypeFamilies #-} |
(previous Yoneda blog) (reddit) (twitter)
Let's explore the Yoneda lemma. You don't need to be an advanced Haskeller to understand this. In fact I claim you will understand the first section fine if you're comfortable with map
/fmap
and id
.
I am not out to motivate it, but we will explore Yoneda at the level of terms and at the level of types.
import Data.Functor.Yoneda
import Data.Char
import Data.Kind
infixr 5
·
type List :: (Type -> Type) -> Constraint
class List f where