This file contains 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 Ch19 where | |
import Prelude | |
import Data.Generic.Rep (class Generic) | |
import Data.Show.Generic (genericShow) | |
import Effect (Effect) | |
import Effect.Console (log) | |
----------- | |
-- Maybe -- |
This file contains 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 Ch17Parser where | |
import Prelude | |
import Data.Either (Either(..)) | |
import Data.Maybe (Maybe(..)) | |
import Data.Tuple (Tuple(..)) | |
import Data.Array as A | |
import Data.Unfoldable as U | |
import Data.Traversable (class Traversable, sequence) | |
import Data.Generic.Rep (class Generic) |
This file contains 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 Ch17 where | |
( Age (..) | |
, FamilyAges(..) | |
, FamilyAgesRow | |
, Validation(..) | |
, Either(..) | |
, createFamilyAges | |
, test | |
) where |
This file contains 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 Ch15 where | |
import Prelude | |
import Data.Int (even, odd) | |
import Data.Foldable (class Foldable, foldl) | |
import Data.List (List(..), (:)) | |
import Data.String (length) | |
import Effect (Effect) | |
import Effect.Console (log) |
This file contains 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
================================================================================================= | |
| Mapping functions | | |
================================================================================================= | |
------------------------ | |
| One mapping function | | |
------------------------ | |
class Functor f where | |
map :: ∀ a b. (a -> b) -> f a -> f b (Covariant) |
This file contains 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 Ch13 where | |
import Prelude (Unit, class Eq, class Show, discard, flip, identity, show, ($), (/), (<>), (==), (*), (<<<)) | |
import Data.Generic.Rep (class Generic) | |
import Data.Show.Generic (genericShow) | |
import Data.String.Common (toUpper) | |
import Effect (Effect) | |
import Effect.Console (log) | |
----------- Type classes ---------------------------------------------------------------------------------------------------------------------------------- |
This file contains 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 Ch11 where | |
import Prelude (Unit, class Semiring, class Ord, type (~>), discard, flip, negate, otherwise, show, zero, ($), (>), (+), (<>), (<<<)) | |
import Data.Foldable (class Foldable, foldl, foldr, foldMap) | |
import Data.Semigroup.Foldable (class Foldable1, foldl1) | |
import Data.List (List(..), (:), singleton) | |
import Data.List.Types (NonEmptyList(..)) | |
import Data.NonEmpty ((:|)) | |
import Effect (Effect) | |
import Effect.Console (log) |
This file contains 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 Ch09 where | |
import Prelude (Unit, class Show, class Eq, discard, ($), show, (==), (&&)) | |
import Data.Generic.Rep (class Generic) | |
import Data.Show.Generic (genericShow) | |
import Data.Maybe (Maybe(..)) | |
import Effect (Effect) | |
import Effect.Console (log) | |
----------- Type Classes --------------------------------------------------------------------------- |
This file contains 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 Ch07b where | |
import Prelude (Unit, discard, show, ($), (<>), (==), (#)) | |
import Data.Eq (class Eq) | |
import Data.Show (class Show) | |
import Data.Generic.Rep (class Generic) | |
import Data.Newtype (class Newtype) | |
import Data.Maybe (Maybe(..)) | |
import Data.Show.Generic (genericShow) | |
import Data.Int (fromString) |