View Main.hs
module Main where
import Control.Applicative
import Data.Monoid
import Test.QuickCheck
import Test.QuickCheck.Checkers
import Test.QuickCheck.Classes
instance Monoid a => Monoid (ZipList a) where
mempty = pure mempty
View Main.hs
module Main where
import Control.Applicative
import Data.Monoid
import Test.QuickCheck
import Test.QuickCheck.Checkers
import Test.QuickCheck.Classes
instance Monoid a => Monoid (ZipList a) where
mempty = pure mempty
View Main.hs
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeOperators #-}
module Main where
-- | 'f ~> g' means natural transformation from a functor 'f' to a functor 'g'
type (~>) f g = forall a. f a -> g a
-- | const functor, which works as if it's just a constant
View Spec.hs
import Test.Hspec
import Test.Hspec.QuickCheck (prop)
main :: IO ()
main = hspec $ do
describe "quickcheck" $ do
prop "assoc" $ \x y z ->
x + (y + z) == ((x + y) + (z :: Double))
View sum-of-records-bottom-haskell.md

Let me guess there is a data PL as a sum type of records:

data PL = Functional { name :: String, pure :: Bool }
        | ObjectOriented { name :: String, multipleInheritance :: Bool }

The type of pure is:

View digestive-functors-tutorial.md
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
import Control.Applicative ((<$>), (<*>))
import Data.Maybe (isJust)
import Data.Text (Text)
import Text.Blaze ((!))
View rmfc.md
View code-poet.hs
timestampPath :: IO FilePath
timestampPath = ???
-- using do, more readable.
writeTimestamp :: UnixTime -> IO ()
writeTimestamp x = do
path <- timestampPath
writeFile path (encodeUnixTime x)
-- using point-free style, feeling good.
View LineNotify.hs
{-# LANGUAGE OverloadedStrings #-}
module Line
( Message (..)
, Messageable (..)
, send
) where
import Control.Lens
import Data.Text
View ps-v1-public.md

PS v1 is still in heavy development and everything can be discussed and changed later. It's being developed in the next branch, so please take a look if interested.

API

The following code shows how PS v1 will be used. For the detailed information, some parts are tagged with a number following *. The details are described below with the indexing number.