Open sir4ur0n opened 5 years ago
Thanks for filing this! Sounds like we should do a documentation milestone.
For what it's worth: I recently started a blog and my first 2 posts (and probably a few more in the coming months) are about Introduction to Polysemy:
I feel like some (or all if you wish) content of these posts could be reused in the Haddock of Polysemy.
Incidentally, if you like the blog post, feel free to refer to it in Polysemy documentation :sweat_smile:
@Sir4ur0n awesome, thanks! I'll have a look! I'm more than happy to merge any PRs that you think would improve documentation in the library's haddocks directly!
I tried to build Polysemy (using Stack) on my Windows machine but it gets stuck every single time on compiling Polysemy.Final
:
$ stack build
polysemy > configure (lib)
polysemy > Configuring polysemy-1.2.3.0...
polysemy > build (lib)
polysemy > Preprocessing library for polysemy-1.2.3.0..
polysemy > Building library for polysemy-1.2.3.0..
polysemy > [ 1 of 41] Compiling Polysemy.Embed.Type
polysemy > [ 2 of 41] Compiling Polysemy.Fail.Type
polysemy > [ 3 of 41] Compiling Polysemy.Internal.CustomErrors.Redefined
polysemy > [ 4 of 41] Compiling Polysemy.Internal.Fixpoint
polysemy > [ 5 of 41] Compiling Polysemy.Internal.Kind
polysemy > [ 6 of 41] Compiling Polysemy.Internal.CustomErrors
polysemy > [ 7 of 41] Compiling Polysemy.Internal.NonDet
polysemy > [ 8 of 41] Compiling Polysemy.Internal.PluginLookup
polysemy > [ 9 of 41] Compiling Polysemy.Internal.Union
polysemy > [10 of 41] Compiling Polysemy.Internal
polysemy > [11 of 41] Compiling Polysemy.Internal.Tactics
polysemy > [12 of 41] Compiling Polysemy.Internal.TH.Common
polysemy > [13 of 41] Compiling Polysemy.Internal.TH.Effect
polysemy > [14 of 41] Compiling Polysemy.Internal.Forklift
polysemy > [15 of 41] Compiling Polysemy.Internal.Combinators
polysemy > [16 of 41] Compiling Polysemy.Internal.Strategy
polysemy > [17 of 41] Compiling Polysemy.Final
I know I technically don't need to compile to write doc, but I like to ensure doc is well-formatted.
Am I alone with this issue? š¤
Template Haskell is bugged on Windows with GHC 8.6.3, and often hangs the compiler when used. Modify stack.yaml
to use a newer resolver than lts-13.0
(like lts-14.16
, which is the most recent LTS), so you're using GHC 8.6.5+, and you should be good. This is actually what I personally do when working on this repo.
Well, now I feel silly, sorry for bothering you š
Is there any reason why the Stack resolver on master
isn't more recent than 13.0
?
Alternatively, maybe the README should explain how to build/test, and mention this particularity for Windows users? I did not find any such piece of information.
Either way, thank you @KingoftheHomeless , your fix did the trick! I'll get back to (try to) hack Polysemy documentation.
@isovector You've wanted to stick with 13.0
in the past. Is there any particular reason why? Otherwise I'd like to upgrade it.
@KingoftheHomeless you're the boss now!
@KingoftheHomeless: I think you should upgrade it then!
In the same spirit as #232 but for the other side of the spectrum: I feel like the documentation (particularly the main readme displayed on Hackage/Stackage, but also in each module doc) could be improved, and help new users onboarding in Polysemy.
We just started using Polysemy in my team and we have some feedback I propose to gather here as we progress on the Polysemy scale. Each point could become a dedicated issue/PR if you agree they should be worked on (we may be able to help!).
-- | Here the EnvironmentVariables effect contains a single action named ReadEnvVar, describing reading environment variables. It takes the environment variable name as String to read, and returns a Maybe String of the value (in case it is not defined) data EnvironmentVariables m a where ReadEnvVar :: String -> EnvironmentVariables m (Maybe String)
-- | Provides the
readEnvVar
action without us having to write boilerplate makeSem ''EnvironmentVariables-- | The
Member EnvironmentVariables r
constraint means we are allowed to use theEnvironmentVariables
effect, i.e. thereadEnvVar
function myBusinessFunction :: Member EnvironmentVariables r => Sem r String myBusinessFunction = do -- We use theEnvironmentVariables
effect actionreadEnvVar
maybeFoo <- readEnvVar "foo" -- Do whatever you want with this value now! return $ fromMaybe "default foo value" maybeFoo-- | At some point you want to get out of the Polysemy/effect context, be it in your main, in some intermediary business function, in your tests, etc. -- This is where you use interpreters! They do exactly that: interpret effects to get the real stuff out of it myOtherCode :: IO String myOtherCode = runM . environmentVariablesToIO $ myBusinessFunction
All that being said, so far we are falling in love with Polysemy, thank you for this library! I can't wait to see what it enables us to build in the coming months.
Cheers!