diff --git a/resources/template.tex b/resources/template.tex index 06ecbd4..18d0e45 100644 --- a/resources/template.tex +++ b/resources/template.tex @@ -8,13 +8,14 @@ %total={21cm,25cm}, %papersize={21cm,25cm}, papersize={8.125in,10.250in}, + bindingoffset=0.2in, top=1.5cm, bottom=1.5cm, inner=1.91cm, outer=6.68cm, % For pdf - left=1.5cm, - right=1.5cm, + left=2.0cm, + right=2.0cm, % For print %marginparwidth=4cm, %marginparsep=0.8cm diff --git a/tutorial.md b/tutorial.md index c8e8773..9a5e678 100644 --- a/tutorial.md +++ b/tutorial.md @@ -1945,6 +1945,22 @@ For example the following are equivalent: (+) x y = x + y ``` +Where & Let Clauses +------------------- + +TODO + +```haskell +``` + +Comments +-------- + +TODO + +```haskell +``` + Typeclasses ----------- @@ -2049,6 +2065,25 @@ frequently and defined over many prelude types: * **RealFrac** - Provides an interface for rounding real values. * **RealFloat** - Provides an interface for working with IEE754 operations. +To see the implementation for any of these typeclasses you can run the GHCi info +command to see the methods and all instances in scope. For example: + +```haskell +λ: :info Num + class (Eq a, Show a) => Num a where + (+) :: a -> a -> a + (*) :: a -> a -> a + (-) :: a -> a -> a + negate :: a -> a + abs :: a -> a + signum :: a -> a + fromInteger :: Integer -> a + -- Imported from GHC.Num + instance Num Float -- Imported from GHC.Float + instance Num Double -- Imported from GHC.Float + instance Num Integer -- Imported from GHC.Num + instance Num Int -- Imported from GHC.Num + Many of the default classes have instances that can be deriving automatically. After the definition of a datatype you can add a `deriving` clause which will generate the instances for this datatype automatically. This does not work @@ -3902,10 +3937,6 @@ Or equivalently: It's useful to remember that transformers compose *outside-in* but are *unrolled inside out*. -See: - -* [Monad Transformers: Step-By-Step](https://page.mi.fu-berlin.de/scravy/realworldhaskell/materialien/monad-transformers-step-by-step.pdf) - Transformers ------------ @@ -4343,6 +4374,20 @@ runExample2 = do print result ``` +Polysemy will require the following language extensions to operate: + + +```haskell +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +``` + The use of free-monads is not entirely without cost, and there are experimental GHC plugins which can abstract away some of the overhead from the effect stack. Code thats makse use of polysemy should enable the following GHC flags to enable @@ -5961,14 +6006,14 @@ would not be chose laziness as the default model. Future implementations of Haskell compilers would also probably also not choose this point in the design space if given the option of breaking with the language specification. -There is a lot of fear uncertainy and doubt spread about lazy evaluation that +There is a lot of fear uncertainty and doubt spread about lazy evaluation that unfortunately that gets loses the forest for the trees and ignores 30 years of advanced research on the type system. In industrial programming a lot of software is sold on the meme of being of *fast* instead of being *correct*, and -lazy evaluation becomes a easy talking point about these upside-down priorities. -Nevertheless the colloquial perception of a laziness being "evil" is a meme that -will continue to persist regardless of any underlying reality because software -is intrinsically a social process. +lazy evaluation is an intellectually easy talking point about these upside-down +priorities. Nevertheless the colloquial perception of a laziness being "evil" +is a meme that will continue to persist regardless of any underlying reality +because software is intrinsically a social process.