From 4029e3597735c5e69e723b57636e15775bc3b4cd Mon Sep 17 00:00:00 2001 From: Oleg Date: Mon, 22 Mar 2021 16:49:27 +0700 Subject: [PATCH 1/5] jun3-extensions-corrections --- backend/junior-3/haskell.md | 108 ++++++++++++++++++++++-------------- backend/middle-1/haskell.md | 1 + 2 files changed, 68 insertions(+), 41 deletions(-) diff --git a/backend/junior-3/haskell.md b/backend/junior-3/haskell.md index 6e577fa2..8be5a3bf 100644 --- a/backend/junior-3/haskell.md +++ b/backend/junior-3/haskell.md @@ -18,10 +18,6 @@ * Monads * Антон Холомьёв. Учебник по Haskell. Глава 8. IO -### Types - -* What is kind? - ### Lists * What is the difference between `foldl'`, `foldr'` and `foldl`, `foldr`? @@ -84,8 +80,15 @@ * `DeriveTraversable` * `GeneralizedNewtypeDeriving` * `DeriveAnyClass` + * `DerivingVia` * `DerivingStrategies` * `RecordWildCards` + +#### Resources + +* RecordWildCards + * [The Power of RecordWildCards](https://kodimensional.dev/recordwildcards) + * `TypeOperators` * `FlexibleContexts` & `FlexibleInstances` * `MultiParamTypeClasses` & `FunctionalDependencies` @@ -101,6 +104,18 @@ * How closed type families can help to create overlapping type classes instances? * What are the differences between Functional Dependencies and associated Type Families? What are the situations when the best choice would be to use associated type families, and when it would be fundeps? + +#### Resources + +* Type and Data Families + * [Haskell's Type Families presentation](https://cdepillabout.github.io/haskell-type-families-presentation/#/) + * [24 Days of GHC Extensions: Type Families](https://ocharles.org.uk/blog/posts/2014-12-12-type-families.html) + * [Haskell Injectivity Of Type Families And Reasons Of Its Ambiguity](https://wapxmas.github.io/haskell-injectivity/) + * [Avoid overlapping instances with closed type families](https://kseo.github.io/posts/2017-02-05-avoid-overlapping-instances-with-closed-type-families.html) + * [String interpolation and overlapping instances 101](https://williamyaoh.com/posts/2019-05-27-string-interpolation-and-overlapping-instances.html) + * [Type families usage in servant](https://arow.info/blog/posts/2015-07-10-servant-intro.html) + * [Why can't we define closed data families?](https://stackoverflow.com/questions/49433716/why-cant-we-define-closed-data-families) + * GADTs * What is the difference between GADT and ADT? * What is the main goal of GADT? @@ -109,30 +124,65 @@ * Are record fields available for GADT? * Is it considered a good practice to put constraints in consructors inside GADT declaration? * How does deriving instances work for GADT? What problems may occur? + +#### Resources + +* [Wikibooks]() +* [Haskell wiki]() +* [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-GADTs) +* [Fun with phantom types](http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf) +* [Type Constraints in Data Declaration Haskell](https://stackoverflow.com/questions/40825878/type-constraints-in-data-declaration-haskell) +* [GADTs vs. MultiParamTypeClasses](https://stackoverflow.com/questions/10994508/gadts-vs-multiparamtypeclasses) + * Data Kinds + * What is kind? * What is the kind `*`? What is the kind `Type`? * What is the data type promotion? * What is the main goal for using `DataKinds`? * Is apostrophe (' symbol) required in a name of a promoted data type? * Are types with promoted kinds inhabited? - * What is inconvenience we've got with `DataKinds`, concerned with terms level of promoted types? + * Can we create a function from a regular data type into promoted one and vice versa? * What are types which can't be promoted? * How can heterogenous lists be implemented with `DataKinds` and `GADTs`? * What are the dependent types and how `DataKinds` allow us to get closer to them? + +#### Resources + +* [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-DataKinds) +* [Paper - Giving Haskell a Promotion](https://www.seas.upenn.edu/~sweirich/papers/tldi12.pdf) +* [Basic Type Level Programming in Haskell](http://www.parsonsmatt.org/2017/04/26/basic_type_level_programming_in_haskell.html) +* [Haskell's kind system - a primer](https://diogocastro.com/blog/2018/10/17/haskells-kind-system-a-primer/) +* [The Future of Programming is Dependent Types — Programming Word of the Day](https://medium.com/background-thread/the-future-of-programming-is-dependent-types-programming-word-of-the-day-fcd5f2634878) +* [What is dependent typing?](https://stackoverflow.com/questions/9338709/what-is-dependent-typing) +* [Does haskell have dependent types?](https://softwareengineering.stackexchange.com/questions/182066/does-haskell-have-dependent-types) + * Polymorphic Kinds * What is the main goal of `PolyKinds`? * How it can be used? * What declarations would have the inferred kind `*` and not polykinded `forall k. k`? * What is `Proxy` datatype? What is it used for? Why do we need `PolyKinds` to implement it? + +#### Resources + +* [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#kind-polymorphism-and-type-in-type) +* [Kwang's Haskell Blog - Data.Proxy](https://kseo.github.io/posts/2017-01-15-data-proxy.html) + * `ScopedTypeVariables` * What is the main goal of this extension? * Higher ranked types * What is a "rank" of a function? * Give examples of rank-1, rank-2, rank-3 functions. * What is the main goal of `RankNTypes` extension? - * Provide example cases on when we can use `ExistentialQuantification` and when we can use `RankNTypes`. * Can we create datatypes and newtypes with `RankNTypes`? * Can we use constraints with `RankNTypes`? + +#### Resources + +* Higher ranked types + * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-RankNTypes) + * [Higher-rank and higher-kinded types](https://www.stephanboyer.com/post/115/higher-rank-and-higher-kinded-types) + * [Haskell wiki](https://wiki.haskell.org/Rank-N_types) + * `ExistentialQuantification` * What is the main goal of the `ExistentialQuantification` extension? * Can we use constraints for types of quantified constructor parameters? @@ -147,42 +197,9 @@ * What are the situations which require using `ScopedTypeVariables`, `ExistentialQuantification`, `RankNTypes`? Compare the use cases of theese extensions. * Could existential type be promoted with `DataKinds` extension? -* `ConstraintKinds` - * What is the main goal of the extension? - * What types and type variables would have a kind `Constraint` with this extension enabled? - * What is the pattern of Indexed constraints? What is its goal? - * How pattern Reified dictionaries can be implemented with this extension enabled? - * How Generic programming can be improved with this extension enabled? - * Could classes be partially applied? -#### GHC extensions resources +#### Resources -* RecordWildCards - * [The Power of RecordWildCards](https://kodimensional.dev/recordwildcards) -* Type and Data Families - * [Avoid overlapping instances with closed type families](https://kseo.github.io/posts/2017-02-05-avoid-overlapping-instances-with-closed-type-families.html) - * [String interpolation and overlapping instances 101](https://williamyaoh.com/posts/2019-05-27-string-interpolation-and-overlapping-instances.html) - * [Type families usage in servant](https://arow.info/blog/posts/2015-07-10-servant-intro.html) -* GADTs - * [Wikibooks]() - * [Haskell wiki]() - * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-GADTs) - * [Fun with phantom types](http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf) - * [Type Constraints in Data Declaration Haskell](https://stackoverflow.com/questions/40825878/type-constraints-in-data-declaration-haskell) -* DataKinds - * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-DataKinds) - * [Paper - Giving Haskell a Promotion](https://www.seas.upenn.edu/~sweirich/papers/tldi12.pdf) - * [Basic Type Level Programming in Haskell](http://www.parsonsmatt.org/2017/04/26/basic_type_level_programming_in_haskell.html) - * [Haskell's kind system - a primer](https://diogocastro.com/blog/2018/10/17/haskells-kind-system-a-primer/) - * [The Future of Programming is Dependent Types — Programming Word of the Day](https://medium.com/background-thread/the-future-of-programming-is-dependent-types-programming-word-of-the-day-fcd5f2634878) - * [What is dependent typing?](https://stackoverflow.com/questions/9338709/what-is-dependent-typing) - * [Does haskell have dependent types?](https://softwareengineering.stackexchange.com/questions/182066/does-haskell-have-dependent-types) -* PolyKinds - * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#kind-polymorphism-and-type-in-type) -* Higher ranked types - * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-RankNTypes) - * [Higher-rank and higher-kinded types](https://www.stephanboyer.com/post/115/higher-rank-and-higher-kinded-types) - * [Haskell wiki](https://wiki.haskell.org/Rank-N_types) * Existential types * [Haskell Wiki](https://wiki.haskell.org/Existential_type) * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#existentially-quantified-data-constructors) @@ -190,8 +207,17 @@ * [Why there is no an "Exist" keyword](https://stackoverflow.com/questions/28545545/why-there-is-no-an-exist-keyword-in-haskell-for-existential-quantification) * [What's the theoretical basis for existential types](https://stackoverflow.com/questions/10753073/whats-the-theoretical-basis-for-existential-types) * [What does the `forall` keyword in Haskell/GHC do](https://stackoverflow.com/questions/3071136/what-does-the-forall-keyword-in-haskell-ghc-do) - * [Logic for Economists (optional resource)](https://www.coursera.org/learn/logic-for-economists/home/welcome) + * `ConstraintKinds` + * What is the main goal of the extension? + * What types and type variables would have a kind `Constraint` with this extension enabled? + * What is the pattern of Indexed constraints? What is its goal? + * How pattern Reified dictionaries can be implemented with this extension enabled? + * Could classes be partially applied? + +#### Resources + +* ConstraintKinds * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-ConstraintKinds) * [Constraint Kinds for GHC](http://blog.omega-prime.co.uk/2011/09/10/constraint-kinds-for-ghc/) * [The Constraint kind](https://jeltsch.wordpress.com/2013/02/14/the-constraint-kind/) diff --git a/backend/middle-1/haskell.md b/backend/middle-1/haskell.md index f6a46679..7e3ce781 100644 --- a/backend/middle-1/haskell.md +++ b/backend/middle-1/haskell.md @@ -131,6 +131,7 @@ Why is `unliftio` considered safer by the author of `safe-exceptions`? * Suppose we have `data Example b c = A | B b | C Int c`: * What is the `Rep (Example b c)` type? * What would be the result of `to (C 2 "fsd")`? +* How Generic programming can be improved with this `ConstraintKinds` extension enabled? #### Generics resources From 684b724c10a0a2922d70dc9600e00652ab109ded Mon Sep 17 00:00:00 2001 From: Oleg Date: Mon, 22 Mar 2021 19:11:19 +0700 Subject: [PATCH 2/5] headings for junior-3 extensions --- backend/junior-3/haskell.md | 145 ++++++++++++++++++------------------ 1 file changed, 74 insertions(+), 71 deletions(-) diff --git a/backend/junior-3/haskell.md b/backend/junior-3/haskell.md index 8be5a3bf..95a9000b 100644 --- a/backend/junior-3/haskell.md +++ b/backend/junior-3/haskell.md @@ -73,6 +73,8 @@ ### GHC extensions +#### Deriving, RecordWildCards, TypeOperators, type classes' extensions + * Extensions for deriving: * `StandaloneDeriving` * `DeriveFunctor` @@ -83,27 +85,24 @@ * `DerivingVia` * `DerivingStrategies` * `RecordWildCards` +* `TypeOperators` +* `FlexibleContexts` & `FlexibleInstances` +* `MultiParamTypeClasses` & `FunctionalDependencies` #### Resources * RecordWildCards * [The Power of RecordWildCards](https://kodimensional.dev/recordwildcards) -* `TypeOperators` -* `FlexibleContexts` & `FlexibleInstances` -* `MultiParamTypeClasses` & `FunctionalDependencies` -* Type and Data Families - * What are the three variations of type families: closed, open, associated? - What are their difference and purpose? - * What is injectivity? - * Is open type/data family injective? - Would type/data family be injective if it was associated with a type class? - Would type/data family be injective if it would be closed? - * Why there are no closed data families? - * Can open type family instances overlap with parameters? Can closed typed families do it? - * How closed type families can help to create overlapping type classes instances? - * What are the differences between Functional Dependencies and associated Type Families? - What are the situations when the best choice would be to use associated type families, and when it would be fundeps? +#### Type and Data Families + +* What are the three variations of type families: closed, open, associated? What are their difference and purpose? +* What is injectivity? +* Is open type/data family injective? Would type/data family be injective if it was associated with a type class? Would type/data family be injective if it would be closed? +* Why there are no closed data families? +* Can open type family instances overlap with parameters? Can closed typed families do it? +* How closed type families can help to create overlapping type classes instances? +* What are the differences between Functional Dependencies and associated Type Families? What are the situations when the best choice would be to use associated type families, and when it would be fundeps? #### Resources @@ -116,14 +115,15 @@ * [Type families usage in servant](https://arow.info/blog/posts/2015-07-10-servant-intro.html) * [Why can't we define closed data families?](https://stackoverflow.com/questions/49433716/why-cant-we-define-closed-data-families) -* GADTs - * What is the difference between GADT and ADT? - * What is the main goal of GADT? - * What is the difference between `GADTs` and phantom types? - * How GADT helps us to go from type level to term level in pattern matching? - * Are record fields available for GADT? - * Is it considered a good practice to put constraints in consructors inside GADT declaration? - * How does deriving instances work for GADT? What problems may occur? +#### GADTs + +* What is the difference between GADT and ADT? +* What is the main goal of GADT? +* What is the difference between `GADTs` and phantom types? +* How GADT helps us to go from type level to term level in pattern matching? +* Are record fields available for GADT? +* Is it considered a good practice to put constraints in consructors inside GADT declaration? +* How does deriving instances work for GADT? What problems may occur? #### Resources @@ -134,17 +134,18 @@ * [Type Constraints in Data Declaration Haskell](https://stackoverflow.com/questions/40825878/type-constraints-in-data-declaration-haskell) * [GADTs vs. MultiParamTypeClasses](https://stackoverflow.com/questions/10994508/gadts-vs-multiparamtypeclasses) -* Data Kinds - * What is kind? - * What is the kind `*`? What is the kind `Type`? - * What is the data type promotion? - * What is the main goal for using `DataKinds`? - * Is apostrophe (' symbol) required in a name of a promoted data type? - * Are types with promoted kinds inhabited? - * Can we create a function from a regular data type into promoted one and vice versa? - * What are types which can't be promoted? - * How can heterogenous lists be implemented with `DataKinds` and `GADTs`? - * What are the dependent types and how `DataKinds` allow us to get closer to them? +#### DataKinds + +* What is kind? +* What is the kind `*`? What is the kind `Type`? +* What is the data type promotion? +* What is the main goal for using `DataKinds`? +* Is apostrophe (' symbol) required in a name of a promoted data type? +* Are types with promoted kinds inhabited? +* Can we create a function from a regular data type into promoted one and vice versa? +* What are types which can't be promoted? +* How can heterogenous lists be implemented with `DataKinds` and `GADTs`? +* What are the dependent types and how `DataKinds` allow us to get closer to them? #### Resources @@ -156,17 +157,20 @@ * [What is dependent typing?](https://stackoverflow.com/questions/9338709/what-is-dependent-typing) * [Does haskell have dependent types?](https://softwareengineering.stackexchange.com/questions/182066/does-haskell-have-dependent-types) -* Polymorphic Kinds - * What is the main goal of `PolyKinds`? - * How it can be used? - * What declarations would have the inferred kind `*` and not polykinded `forall k. k`? - * What is `Proxy` datatype? What is it used for? Why do we need `PolyKinds` to implement it? +#### Polymorphic Kinds + +* What is the main goal of `PolyKinds`? +* How it can be used? +* What declarations would have the inferred kind `*` and not polykinded `forall k. k`? +* What is `Proxy` datatype? What is it used for? Why do we need `PolyKinds` to implement it? #### Resources * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#kind-polymorphism-and-type-in-type) * [Kwang's Haskell Blog - Data.Proxy](https://kseo.github.io/posts/2017-01-15-data-proxy.html) +#### ScopedTypeVariables, Higher ranked types + * `ScopedTypeVariables` * What is the main goal of this extension? * Higher ranked types @@ -183,44 +187,43 @@ * [Higher-rank and higher-kinded types](https://www.stephanboyer.com/post/115/higher-rank-and-higher-kinded-types) * [Haskell wiki](https://wiki.haskell.org/Rank-N_types) -* `ExistentialQuantification` - * What is the main goal of the `ExistentialQuantification` extension? - * Can we use constraints for types of quantified constructor parameters? - * Can we use different constraints for different constructor? - * Could we use existentially quantified types in record constructors? - * What is the scope of existential type variables? - * Can we use `ExistentialQuantification` when declaring `newtype`? - * Can we pattern-match on an existentially quantified constructor in `let` or `where` block? - * Can we pattern-match on an existentially quantified constructor in `case` block? - * Can we use `deriving` with existentially quantified data types? - * Why is there no `exist` keyword in Haskell? - * What are the situations which require using `ScopedTypeVariables`, `ExistentialQuantification`, `RankNTypes`? - Compare the use cases of theese extensions. - * Could existential type be promoted with `DataKinds` extension? +#### ExistentialQuantification + +* What is the main goal of the `ExistentialQuantification` extension? +* Can we use constraints for types of quantified constructor parameters? +* Can we use different constraints for different constructor? +* Could we use existentially quantified types in record constructors? +* What is the scope of existential type variables? +* Can we use `ExistentialQuantification` when declaring `newtype`? +* Can we pattern-match on an existentially quantified constructor in `let` or `where` block? +* Can we pattern-match on an existentially quantified constructor in `case` block? +* Can we use `deriving` with existentially quantified data types? +* Why is there no `exist` keyword in Haskell? +* What are the situations which require using `ScopedTypeVariables`, `ExistentialQuantification`, `RankNTypes`? Compare the use cases of these extensions. +* Could existential type be promoted with `DataKinds` extension? #### Resources -* Existential types - * [Haskell Wiki](https://wiki.haskell.org/Existential_type) - * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#existentially-quantified-data-constructors) - * [WikiBooks](https://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types) - * [Why there is no an "Exist" keyword](https://stackoverflow.com/questions/28545545/why-there-is-no-an-exist-keyword-in-haskell-for-existential-quantification) - * [What's the theoretical basis for existential types](https://stackoverflow.com/questions/10753073/whats-the-theoretical-basis-for-existential-types) - * [What does the `forall` keyword in Haskell/GHC do](https://stackoverflow.com/questions/3071136/what-does-the-forall-keyword-in-haskell-ghc-do) - -* `ConstraintKinds` - * What is the main goal of the extension? - * What types and type variables would have a kind `Constraint` with this extension enabled? - * What is the pattern of Indexed constraints? What is its goal? - * How pattern Reified dictionaries can be implemented with this extension enabled? - * Could classes be partially applied? +* [Haskell Wiki](https://wiki.haskell.org/Existential_type) +* [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#existentially-quantified-data-constructors) +* [WikiBooks](https://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types) +* [Why there is no an "Exist" keyword](https://stackoverflow.com/questions/28545545/why-there-is-no-an-exist-keyword-in-haskell-for-existential-quantification) +* [What's the theoretical basis for existential types](https://stackoverflow.com/questions/10753073/whats-the-theoretical-basis-for-existential-types) +* [What does the `forall` keyword in Haskell/GHC do](https://stackoverflow.com/questions/3071136/what-does-the-forall-keyword-in-haskell-ghc-do) + +#### ConstraintKinds + +* What is the main goal of the extension? +* What types and type variables would have a kind `Constraint` with this extension enabled? +* What is the pattern of Indexed constraints? What is its goal? +* How pattern Reified dictionaries can be implemented with this extension enabled? +* Could classes be partially applied? #### Resources -* ConstraintKinds - * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-ConstraintKinds) - * [Constraint Kinds for GHC](http://blog.omega-prime.co.uk/2011/09/10/constraint-kinds-for-ghc/) - * [The Constraint kind](https://jeltsch.wordpress.com/2013/02/14/the-constraint-kind/) +* [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-ConstraintKinds) +* [Constraint Kinds for GHC](http://blog.omega-prime.co.uk/2011/09/10/constraint-kinds-for-ghc/) +* [The Constraint kind](https://jeltsch.wordpress.com/2013/02/14/the-constraint-kind/) ### Laziness From 5be86829965b6c30ea28d51f89f44b3688c8238c Mon Sep 17 00:00:00 2001 From: Oleg Date: Tue, 23 Mar 2021 11:14:18 +0700 Subject: [PATCH 3/5] added article about generic programming and constraint kinds on middle-1 --- backend/middle-1/haskell.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/middle-1/haskell.md b/backend/middle-1/haskell.md index 7e3ce781..0ee8ea17 100644 --- a/backend/middle-1/haskell.md +++ b/backend/middle-1/haskell.md @@ -131,7 +131,7 @@ Why is `unliftio` considered safer by the author of `safe-exceptions`? * Suppose we have `data Example b c = A | B b | C Int c`: * What is the `Rep (Example b c)` type? * What would be the result of `to (C 2 "fsd")`? -* How Generic programming can be improved with this `ConstraintKinds` extension enabled? +* How Generic programming can be improved with `ConstraintKinds` extension enabled? #### Generics resources @@ -139,6 +139,7 @@ Why is `unliftio` considered safer by the author of `safe-exceptions`? * [GHC.Generics on Wiki Haskell](https://wiki.haskell.org/GHC.Generics) * [GHC Generics Explained](https://www.stackbuilders.com/tutorials/haskell/generics/) * [Haddock (functions for getting information about datatypes)](https://hackage.haskell.org/package/base-4.8.2.0/docs/GHC-Generics.html#t:Datatype) +* [Constraint Kinds for GHC](http://blog.omega-prime.co.uk/2011/09/10/constraint-kinds-for-ghc/) ### Lenses From b09b078e42cc4c0c9933630882174c9e2f2065da Mon Sep 17 00:00:00 2001 From: Oleg Date: Tue, 23 Mar 2021 12:59:48 +0700 Subject: [PATCH 4/5] designing extensions according to markdown rules --- backend/junior-3/haskell.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/backend/junior-3/haskell.md b/backend/junior-3/haskell.md index 95a9000b..86ca3a79 100644 --- a/backend/junior-3/haskell.md +++ b/backend/junior-3/haskell.md @@ -71,9 +71,8 @@ * Final tagless * [Introduction to Tagless Final](https://serokell.io/blog/2018/12/07/tagless-final) -### GHC extensions -#### Deriving, RecordWildCards, TypeOperators, type classes' extensions +### Deriving, RecordWildCards, TypeOperators, type classes' extensions * Extensions for deriving: * `StandaloneDeriving` @@ -89,12 +88,12 @@ * `FlexibleContexts` & `FlexibleInstances` * `MultiParamTypeClasses` & `FunctionalDependencies` -#### Resources +##### Resources * RecordWildCards * [The Power of RecordWildCards](https://kodimensional.dev/recordwildcards) -#### Type and Data Families +### Type and Data Families * What are the three variations of type families: closed, open, associated? What are their difference and purpose? * What is injectivity? @@ -104,7 +103,7 @@ * How closed type families can help to create overlapping type classes instances? * What are the differences between Functional Dependencies and associated Type Families? What are the situations when the best choice would be to use associated type families, and when it would be fundeps? -#### Resources +##### Resources * Type and Data Families * [Haskell's Type Families presentation](https://cdepillabout.github.io/haskell-type-families-presentation/#/) @@ -115,7 +114,7 @@ * [Type families usage in servant](https://arow.info/blog/posts/2015-07-10-servant-intro.html) * [Why can't we define closed data families?](https://stackoverflow.com/questions/49433716/why-cant-we-define-closed-data-families) -#### GADTs +### GADTs * What is the difference between GADT and ADT? * What is the main goal of GADT? @@ -125,7 +124,7 @@ * Is it considered a good practice to put constraints in consructors inside GADT declaration? * How does deriving instances work for GADT? What problems may occur? -#### Resources +##### Resources * [Wikibooks]() * [Haskell wiki]() @@ -134,7 +133,7 @@ * [Type Constraints in Data Declaration Haskell](https://stackoverflow.com/questions/40825878/type-constraints-in-data-declaration-haskell) * [GADTs vs. MultiParamTypeClasses](https://stackoverflow.com/questions/10994508/gadts-vs-multiparamtypeclasses) -#### DataKinds +### DataKinds * What is kind? * What is the kind `*`? What is the kind `Type`? @@ -147,7 +146,7 @@ * How can heterogenous lists be implemented with `DataKinds` and `GADTs`? * What are the dependent types and how `DataKinds` allow us to get closer to them? -#### Resources +##### Resources * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-DataKinds) * [Paper - Giving Haskell a Promotion](https://www.seas.upenn.edu/~sweirich/papers/tldi12.pdf) @@ -157,19 +156,19 @@ * [What is dependent typing?](https://stackoverflow.com/questions/9338709/what-is-dependent-typing) * [Does haskell have dependent types?](https://softwareengineering.stackexchange.com/questions/182066/does-haskell-have-dependent-types) -#### Polymorphic Kinds +### Polymorphic Kinds * What is the main goal of `PolyKinds`? * How it can be used? * What declarations would have the inferred kind `*` and not polykinded `forall k. k`? * What is `Proxy` datatype? What is it used for? Why do we need `PolyKinds` to implement it? -#### Resources +##### Resources * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#kind-polymorphism-and-type-in-type) * [Kwang's Haskell Blog - Data.Proxy](https://kseo.github.io/posts/2017-01-15-data-proxy.html) -#### ScopedTypeVariables, Higher ranked types +### ScopedTypeVariables, Higher ranked types * `ScopedTypeVariables` * What is the main goal of this extension? @@ -180,14 +179,14 @@ * Can we create datatypes and newtypes with `RankNTypes`? * Can we use constraints with `RankNTypes`? -#### Resources +##### Resources * Higher ranked types * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-RankNTypes) * [Higher-rank and higher-kinded types](https://www.stephanboyer.com/post/115/higher-rank-and-higher-kinded-types) * [Haskell wiki](https://wiki.haskell.org/Rank-N_types) -#### ExistentialQuantification +### ExistentialQuantification * What is the main goal of the `ExistentialQuantification` extension? * Can we use constraints for types of quantified constructor parameters? @@ -202,7 +201,7 @@ * What are the situations which require using `ScopedTypeVariables`, `ExistentialQuantification`, `RankNTypes`? Compare the use cases of these extensions. * Could existential type be promoted with `DataKinds` extension? -#### Resources +##### Resources * [Haskell Wiki](https://wiki.haskell.org/Existential_type) * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#existentially-quantified-data-constructors) @@ -211,7 +210,7 @@ * [What's the theoretical basis for existential types](https://stackoverflow.com/questions/10753073/whats-the-theoretical-basis-for-existential-types) * [What does the `forall` keyword in Haskell/GHC do](https://stackoverflow.com/questions/3071136/what-does-the-forall-keyword-in-haskell-ghc-do) -#### ConstraintKinds +### ConstraintKinds * What is the main goal of the extension? * What types and type variables would have a kind `Constraint` with this extension enabled? @@ -219,7 +218,7 @@ * How pattern Reified dictionaries can be implemented with this extension enabled? * Could classes be partially applied? -#### Resources +##### Resources * [GHC docs](https://downloads.haskell.org/~ghc/8.8-latest/docs/html/users_guide/glasgow_exts.html#extension-ConstraintKinds) * [Constraint Kinds for GHC](http://blog.omega-prime.co.uk/2011/09/10/constraint-kinds-for-ghc/) From a8552bf501c0f29c3215eb8d82df23e66d99963a Mon Sep 17 00:00:00 2001 From: Oleg Date: Tue, 23 Mar 2021 14:47:17 +0700 Subject: [PATCH 5/5] type families resource designing correction --- backend/junior-3/haskell.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/junior-3/haskell.md b/backend/junior-3/haskell.md index 86ca3a79..6ab101b2 100644 --- a/backend/junior-3/haskell.md +++ b/backend/junior-3/haskell.md @@ -105,14 +105,13 @@ ##### Resources -* Type and Data Families - * [Haskell's Type Families presentation](https://cdepillabout.github.io/haskell-type-families-presentation/#/) - * [24 Days of GHC Extensions: Type Families](https://ocharles.org.uk/blog/posts/2014-12-12-type-families.html) - * [Haskell Injectivity Of Type Families And Reasons Of Its Ambiguity](https://wapxmas.github.io/haskell-injectivity/) - * [Avoid overlapping instances with closed type families](https://kseo.github.io/posts/2017-02-05-avoid-overlapping-instances-with-closed-type-families.html) - * [String interpolation and overlapping instances 101](https://williamyaoh.com/posts/2019-05-27-string-interpolation-and-overlapping-instances.html) - * [Type families usage in servant](https://arow.info/blog/posts/2015-07-10-servant-intro.html) - * [Why can't we define closed data families?](https://stackoverflow.com/questions/49433716/why-cant-we-define-closed-data-families) +* [Haskell's Type Families presentation](https://cdepillabout.github.io/haskell-type-families-presentation/#/) +* [24 Days of GHC Extensions: Type Families](https://ocharles.org.uk/blog/posts/2014-12-12-type-families.html) +* [Haskell Injectivity Of Type Families And Reasons Of Its Ambiguity](https://wapxmas.github.io/haskell-injectivity/) +* [Avoid overlapping instances with closed type families](https://kseo.github.io/posts/2017-02-05-avoid-overlapping-instances-with-closed-type-families.html) +* [String interpolation and overlapping instances 101](https://williamyaoh.com/posts/2019-05-27-string-interpolation-and-overlapping-instances.html) +* [Type families usage in servant](https://arow.info/blog/posts/2015-07-10-servant-intro.html) +* [Why can't we define closed data families?](https://stackoverflow.com/questions/49433716/why-cant-we-define-closed-data-families) ### GADTs