@@ -209,10 +209,11 @@ _deep_ inside a function inside a function inside a function, which itself is
209209called against the prod database. I guarantee it.
210210
211211To ensure this never happens, we can use closed phantom types using
212- ` DataKinds ` :
212+ ` DataKinds ` (made nicer with ` TypeData ` post-GHC 9.6) :
213213
214214``` haskell
215- data Env = Prod | Test
215+ -- type data = declare a closed kind and two type constructors at the type level using -XTypeData
216+ type data Env = Prod | Test
216217
217218newtype DbConnection (a :: Env ) = DbConnection Connection
218219
@@ -560,6 +561,11 @@ getUser conn uid = do
560561Pushing it to the driver level will also unify everything with the driver's
561562error-handling system.
562563
564+ These ideas are elaborated further in one of the best Haskell posts of all
565+ time, [ Parse, Don't Validate] [ parse-dont-validate ] .
566+
567+ [ parse-dont-validate ] : https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/
568+
563569### Boolean Blindness
564570
565571At the heart of it, the previous examples' cardinal sin was "boolean
@@ -608,6 +614,13 @@ data LegState = Extended | Retracted
608614deployThrusters :: LegState -> IO ()
609615```
610616
617+ Note that `Maybe ` itself is not immune from " semantic blindness" --- if you
618+ find yourself using a lot of anonymous combinators like `Maybe ` and `Either ` to
619+ get around boolean blindness, be aware of falling into [algebraic
620+ blindness][algebraic- blindness]!
621+
622+ [algebraic- blindness]: https:// github. com/ quchen/ articles/ blob/ master/ algebraic- blindness. md
623+
611624### Resource Cleanup
612625
613626Clean - up of finite system resources is another area that is very easy to assume
@@ -840,3 +853,8 @@ for me to devote time to researching and writing these posts. Very special
840853thanks to my supporter at the "Amazing" level on [ patreon] [ ] , Josh Vera! :)
841854
842855[ patreon ] : https://www.patreon.com/justinle/overview
856+
857+ Also thanks to [ _ jackdk_ 's comment] [ jackdk ] for highlighting extra resources
858+ and context that I believe are very useful and relevant!
859+
860+ [ jackdk ] : https://www.reddit.com/r/haskell/comments/1qtxnsm/comment/o3889uy
0 commit comments