diff --git a/Makefile b/Makefile index f5b9201..fdbd1b1 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,8 @@ includes: includes.hs %.html: %.md includes ./includes < $< \ | $(PANDOC) --template $(HTEMPLATE) -s -f $(IFORMAT) -t html $(FLAGS) $(HFLAGS) \ - | sed '//r extensions.html' > $@ + | sed '//r extensions.html' \ + | sed '//r resources/copyright.html' > $@ %.epub: %.md includes (cat $(ETEMPLATE); ./includes < $<) \ diff --git a/resources/copyright.html b/resources/copyright.html new file mode 100644 index 0000000..02cc88c --- /dev/null +++ b/resources/copyright.html @@ -0,0 +1,21 @@ +

Version

+

This is the fifth major draft of this document since 2009.

+ +

Pull requests are always accepted for changes and additional content. This is a living document. The only way this document will stay up to date is through the kindness of readers like you and community patches and pull requests on Github.

+

Author

+

This text is authored by Stephen Diehl.

+ +

License

+

Copyright © 2009-2020 Stephen Diehl

+

This code included in the text is dedicated to the public domain. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

+

You may distribute this text in its full form freely, but may not reauthor or sublicense this work. Any reproductions of major portions of the text must include attribution.

+

The software is provided “as is”, without warranty of any kind, express or implied, including But not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, Arising from, out of or in connection with the software or the use or other dealings in the software.

diff --git a/tutorial.md b/tutorial.md index 31d3c97..bcd7370 100644 --- a/tutorial.md +++ b/tutorial.md @@ -2,6 +2,8 @@ % Stephen Diehl % February 2020 + + Basics ====== @@ -2672,6 +2674,8 @@ FROM fpco/stack-build:lts-14.0 Continuous Integration ---------------------- +TODO + These days it is quite common to use cloud hosted continuous integration systems to test code from version control systems. There are many community contributed build script for different service providers: @@ -4227,7 +4231,7 @@ APIs. * RankNTypes * [ExistentialQuantification](#quantification) * [TypeFamilies](#type-families) -* [TypeOperators] +* [TypeOperators](#promoted-syntax) * [TypeApplications](#promoted-syntax) * UndecidableInstances @@ -5212,7 +5216,7 @@ one. Historically enabling this on module-level was not the best idea, since generally we define multiple classes in a module only a subset of which may be incoherent. So as of 7.10 we now have the capacity to just annotate instances -with the OVERLAPPING and INCOHERENT pragmas. +with the `OVERLAPPING` and `INCOHERENT` pragmas. ~~~~ {.haskell include="src/04-extensions/overlapping_anno.hs"} ~~~~ @@ -5764,9 +5768,14 @@ read :: Read a => String -> a A list of partial functions in the default prelude: +**Partial for all inputs** + * ``error`` * ``undefined`` -* ``fail`` +* ``fail`` -- For `Monad IO` + +**Partial for empty lists** + * ``head`` * ``init`` * ``tail`` @@ -5780,15 +5789,27 @@ A list of partial functions in the default prelude: * ``cycle`` * ``maximum`` * ``minimum`` -* ``(!!)`` + +**Partial for Nothing** + +* ``fromJust`` + +**Partial for invalid strings lists** + +* ``read`` + +**Partial for infinite lists** + * ``sum`` * ``product`` -* ``fromJust`` -* ``read`` * ``reverse`` + +**Partial for negative or unbounded numbers** + +* ``(!)`` +* ``(!!)`` * ``toEnum`` * ``genericIndex`` -* ``(!)`` Replacing Partiality -------------------- @@ -7899,7 +7920,7 @@ Name Type Signature Descr ----- --------------------------------- ----------------- Catamorphism ``cata :: (a -> b -> b) -> b -> [a] -> b`` Deconstructs a data structure Anamorphism ``ana :: (b -> Maybe (a, b)) -> b -> [a]`` Constructs a structure level by level -Hylomorphism ``hylo :: Functor f => (f b -> b) -> (a -> f a) -> a -> b`` TDO +Hylomorphism ``hylo :: Functor f => (f b -> b) -> (a -> f a) -> a -> b`` TODO For Fix point type over a type `f :: * -> *` we can write down the recursion schemes as the following definitions: @@ -15210,6 +15231,16 @@ The specific flags can be checked by passing `+RTS --info` to a compiled binary. ] ``` +The state of the runtime can also be queried at runtime for statistics about the +heap, garbage collector and wall time. The `getRTSStats` generates two datateyps +wwith all the queryable information contained in `RTSStats` and `GCDetails`. + +```haskell +import GHC.Stats + +getRTSStats :: IO RTSStats +``` +
Profiling