terezka / yaml Goto Github PK
View Code? Open in Web Editor NEWWork with YAML in Elm.
License: BSD 3-Clause "New" or "Revised" License
Work with YAML in Elm.
License: BSD 3-Clause "New" or "Revised" License
I came across this package because I need to parse and generate YAML in Elm. I want to ask about contribution guidelines, mainly:
package.json
with dev deps to run tests?elm.json
doesn't have test deps either?elm-format
is used?I tried to parse the following YAML:
- name: GARLIC
units:
- clove
- grams
- name: "GARLIC POWDER"
units:
- grams
For some reasons GARLIC
is parsed as garlic
(lowercase) while GARLIC POWDER
is parsed in uppercase.
As a fix, I used the following parser:
(Decode.field "name"
(Decode.string
|> Decode.andThen (String.toUpper >> Decode.succeed)
)
)
Hi, I've run into an error I can't seem to get around -- could just be me, but here is a stripped down version. The problem arises with code like
decodeItem : Decoder ( String, Int )
decodeItem =
Decode.string
|> Decode.andThen baz
I've reduced baz
to a bare minimum, so that it always succeeds, always returning the same thing:
baz : String -> Decoder ( String, number )
baz =
\s -> Decode.succeed ( "Test", 88 )
Here is the error:
↓ VerifyExamples.Yaml.DecodeItem0
✗ #decodeItem:
Decode.fromString decodeItem "(Test:88)"
--> Ok ("Test", 88)
Ok ("Test",88)
╷
│ Expect.equal
╵
Err (Parsing "TODO deadEndsToString")
And here is the test code:
{-|
import Yaml.Decode as Decode exposing (Decoder)
Decode.fromString decodeItem "(Test:88)"
--> Ok ("Test", 88)
-}
decodeItem : Decoder ( String, Int )
decodeItem =
Decode.string
|> Decode.andThen baz
Hi!
Is there a way to decode optional fields? Something like Json.Decode’s maybe
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.