Re: [elm-discuss] Re: pattern matching on a field within a record

2016-09-24 Thread Nick H
Re: your initial post... you could rewrite the code as case Maybe.map .cell c of Just (Letter s) -> s _ -> "" Don't know if that's any easier to read, though. Regarding null_square: If you want to make sure that null_square is passed by reference, you can define it as a top-level

[elm-discuss] Emoji library API

2016-09-24 Thread Travis Parker
Hi elm-discuss! I'm Travis Parker ("tjp" on slack) and I've just recently started using elm, first for an internal project at work (so not public code, a green field project though!) and now for a separate, personal project. I've been working with emojis

Re: [elm-discuss] Re: How to make a view with a list of components

2016-09-24 Thread Arthur Welf
There is a law for Functors ("mappable" structures): List.map (f) >> List.map (g) == List.map (f >> g) So, you can compose functions you map over data in list instead of composing several maps on list. > 24 сент. 2016 г., в 23:09, Antoine Snyers > написал(а): >

[elm-discuss] Confused by error (inline function, >, tagged type)

2016-09-24 Thread Joaquín Oltra
Your > seems to be shadowing core's > and thus not letting you compare the floats. It makes sense. Regarding the type wrapping better use a type alias for using the value directly as a float but having it be DropsPerSecond on the type signatures. type alias DropsPerSecond = Float -- You

[elm-discuss] Confused by error (inline function, >, tagged type)

2016-09-24 Thread Max Goldstein
This is likely due to a conflict with core's < which is imported automatically. I'm not sure how much tagged types get you though; maybe a type alias would be a better choice? -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe

[elm-discuss] Re: Modeling cross-references

2016-09-24 Thread Francesco Orsenigo
If the random access happens only on user input, ie it's not something you need to do several thousands times per second, stick to Lists. If you need a particular sorting order, stick to Lists. You can use `Dict.foldl/r` to map a dictionary to a list in a single step, rather than first

[elm-discuss] Re: Modeling cross-references

2016-09-24 Thread Eric G
Thanks for this question and the suggestions - very useful to issues I am dealing with now. Some questions: - Is it better to use Dicts as the basic 'table' structure, if frequently rendering lists of items filtered and sorted in various ways? In short, is it better to convert a `List (ID,

[elm-discuss] Confused by error (inline function, >, tagged type)

2016-09-24 Thread Brian Marick
I’m trying to dutifully use tagged types instead of, say, `Float`: type DropsPerSecond = DropsPerSecond Float It turns out I want to know which of two `DropsPerSecond` is larger. Which suggests this: (>) : DropsPerSecond -> DropsPerSecond -> Bool (>) (DropsPerSecond left) (DropsPerSecond

Re: [elm-discuss] Elm, Objects and Components

2016-09-24 Thread Richard Feldman
Mark, this seems worth a separate thread. Would you mind opening one that explains a couple of motivating problem scenarios, and then this proposed solution? On Sat, Sep 24, 2016, 5:28 PM Mark Hamburg wrote: > I wonder if the following strategy would work to address

[elm-discuss] Re: How to make a view with a list of components

2016-09-24 Thread Antoine Snyers
Wow, what a difference! Thanks a lot, Pierre and Eric, this has been an eye opener for me. On Saturday, September 24, 2016 at 7:26:05 PM UTC+2, Eric G wrote: > > Hi Antoine, > > I think you can use function composition like this to make it easier: > > List.map (viewLog >> App.map TaskLog)

[elm-discuss] Re: Announcing elm-test 2.1.0!

2016-09-24 Thread Andreas Vilinski
I can't wrap my head about how to write a fuzz (generator) for a record with more than 5 fields using andMap operator. Could you please insert an example into the documentation of the andMap function? Like it is done for e.g. Josn.Decode.Extra.apply

Re: [elm-discuss] Re: pattern matching on a field within a record

2016-09-24 Thread Martin DeMello
Don't think that will work because c is of type Maybe Square, not Maybe Cell. One further question - if I define let null_square = { cell = Empty, num = 0 } let get_square maybe_square = case maybe_cell of Nothing: null_square Just s : s let get_letter maybe_square = case

[elm-discuss] The Elm Slack is now archived by SlackArchive.io

2016-09-24 Thread Luke Westby
The link to the archives is http://elmlang.slackarchive.io/ If you are a user of the slack yourself and find that your favorite channel is not being archived you can run the command */invite @archivebot* to get things rolling. Thanks friends! -- You received this message because you are

[elm-discuss] Re: Modeling cross-references

2016-09-24 Thread Spencer Judd
I tend to model things like this with Dicts, Sets, and a type alias for each identifier. So, something like type alias Model = { artists : Dict ArtistId Artist , albums : Dict AlbumId Album } type alias ArtistId = Int type alias Artist = { id : ArtistId , name : String , albums

Re: [elm-discuss] Proposal: shorthand record names

2016-09-24 Thread Janis Voigtländer
That feature, for pattern matching, Elm already has. > Am 24.09.2016 um 20:38 schrieb Dave Thomas : > > I don't think its overly verbose as it is, ocaml has a feature called field > pruning: > >> When the name of a variable coincides with the name of a record field,

Re: [elm-discuss] Proposal: shorthand record names

2016-09-24 Thread Joey Eremondi
Can you give a concrete example of what this would look like in Elm? Are you sure this is compatible with type inference? On Sep 24, 2016 10:46 AM, "Zane Hitchcox" wrote: > Shorthand property names like in javascript >

Re: [elm-discuss] Elm, Objects and Components

2016-09-24 Thread Mark Hamburg
On Sep 24, 2016, at 2:18 AM, Peter Damoc wrote: > >> On Sat, Sep 24, 2016 at 12:20 AM, Richard Feldman >> wrote: >> Got it. >> >> Fair point, although to me this suggests that WCs are best suited for state >> you don't mind losing, e.g. for a

Re: [elm-discuss] Elm, Objects and Components

2016-09-24 Thread Peter Damoc
On Sat, Sep 24, 2016 at 12:20 AM, Richard Feldman < richard.t.feld...@gmail.com> wrote: > Got it. > > Fair point, although to me this suggests that WCs are best suited for > state you don't mind losing, e.g. for a ripple effect. :) > Some of the components might have a complex user interaction