purescript-doctest icon indicating copy to clipboard operation
purescript-doctest copied to clipboard

example of do notation?

Open cakekindel opened this issue 3 years ago • 1 comments

Hi again, I'm having issues with the way do notation is compiled as tests, wondering if this is an issue or if there's something i could be doing differently

--| ```purescript run
--| > import Effect.Unsafe (unsafePerformEffect)
--| > import Effect.Console (log)
--| > unsafePerformEffect $ do
--|                           log "help!"
--|                           mempty
--| unit
--| ```
foo = "bar"

compiles to invalid test code:

main :: Spec Unit
main = describe "Test.DocTest.Effect.Worker" $ do
    it "value spec in docs from: sendMsg" $ show (unsafePerformEffect $ do log "help!"
                             mempty) `shouldEqual` "unit"

    pure unit

cakekindel avatar Mar 18 '21 16:03 cakekindel

That's interesting: That's actually a bug in the purescript pretty printer: https://hackage.haskell.org/package/purescript-0.13.8/docs/src/Language.PureScript.Pretty.Values.html#prettyPrintValue

I'll try to get that fixed

csicar avatar Mar 18 '21 17:03 csicar