In Elm, Debug.log has to be within a let block.
That's not accurate, though it is common. Debug.log has the type Debug.log : String -> a -> a which means it takes a String and anything and returns that last thing. This can be really handy with pipes as an example
Debug.log
Debug.log : String -> a -> a
String
myThing |> doSomething |> Debug.log "my modified thing" |> otherFunc |> Debug.log "after otherFunc change"
This way you can log your thing between steps. Another example could be wanting to log the value being passed into a case .. of
case .. of
case Debug.log "my value" someVal of ...
Also kinda sad that this series is almost over!
Ah, thanks! As always, your input is highly appreciated!
It does feel weird that the 30 days are almost done. Maybe 30 weeks next? :D
I'm happy though - I can easily spend 10-15 minutes re-writing a paragraph, so it will be nice to have more energy to focus on code and projects. :)
Writing is a great tool for learning, so I wouldn't be surprised if I make more posts.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That's not accurate, though it is common.
Debug.log
has the typeDebug.log : String -> a -> a
which means it takes aString
and anything and returns that last thing. This can be really handy with pipes as an exampleThis way you can log your thing between steps. Another example could be wanting to log the value being passed into a
case .. of
Also kinda sad that this series is almost over!
Ah, thanks! As always, your input is highly appreciated!
It does feel weird that the 30 days are almost done. Maybe 30 weeks next? :D
I'm happy though - I can easily spend 10-15 minutes re-writing a paragraph, so it will be nice to have more energy to focus on code and projects. :)
Writing is a great tool for learning, so I wouldn't be surprised if I make more posts.