Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disclaimer about non-working examples in readme #188

Merged
merged 1 commit into from
Aug 13, 2020

Conversation

milesfrain
Copy link
Member

Related to #61

@milesfrain
Copy link
Member Author

We could alternatively update the examples so they compile, but that becomes noisy and shifts focus towards how to use the other libraries. For example, this is what's required to get the first example working.

import Affjax as Ajax
import Affjax.ResponseFormat as ResponseFormat
import Data.Either (Either(..))
import Effect (Effect)
import Effect.Aff (Fiber, launchAff)
import Effect.Class.Console (log)

main :: Effect (Fiber Unit)
main = launchAff do
  result <- Ajax.get ResponseFormat.string "http://example.com"
  case result of
    Left err -> log $ "GET failure: " <> Ajax.printError err
    Right response -> log $ "GET response: " <> response.body

Another option is to just show examples involving delay (as is done in the tests).

import Effect (Effect)
import Effect.Aff (Fiber, Milliseconds(..), delay, launchAff)
import Effect.Class.Console (log)

main :: Effect (Fiber Unit)
main = launchAff do
  log "hello"
  delay $ Milliseconds 1000.0
  log "world

@thomashoneyman thomashoneyman merged commit bc5a928 into purescript-contrib:master Aug 13, 2020
@milesfrain milesfrain deleted the patch-1 branch August 13, 2020 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants