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

Working code examples required #1

Open
peterrenshaw opened this issue Nov 9, 2019 · 0 comments
Open

Working code examples required #1

peterrenshaw opened this issue Nov 9, 2019 · 0 comments

Comments

@peterrenshaw
Copy link

peterrenshaw commented Nov 9, 2019

Working code examples required

Fistly this is a great read and "Thinking Algebraiclly WIth Elm" only decent text I've found on GraphicSVG and Elm .

I have found a problem with the code examples, (no import statements) I understand why, page space is limited. This does nothing for the reader. Do you think a future link to working code will be included?

What I found
Going through the examples in Ch5 and even the simplest of examples at P31 require you to understand and dig through the APIs to work out the import statements.

So instead of:

 -- CH5, P30 
 main = graphicsApp { view = view }
 view = collage 300 300 []

readers need the following:

-- CH5, P30 working example
module Main exposing (main)

import GraphicSVG exposing (circle, collage, filled, red, scale)
import GraphicSVG.App exposing (graphicsApp)



-- MAIN


main =
    graphicsApp { view = view }



-- VIEW


view =
    collage 300
        300
        [ circle 25
            |> filled red
        ]

I've left the spacing in using elm-format to give you an idea of how the formatter displays the code. Working code examples help. Code comprehension and presentation go hand in hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant