[elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-29 Thread Max Goldstein
Just be careful with (:::) in particular. Some other libraries already define it, and there's currently no good way to resolve conflicts. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails

[elm-discuss] Elmx

2016-07-29 Thread OvermindDL1
I am curious what people's thoughts are about Elmx? I looked at it, seemed useful, however it seemed lacking due to the fact that it was not quite 'first class' (and no brunch plugin so I have to run its converter manually, though if I did end up using it more I'd probably make such a

[elm-discuss] Re: Multiple uses of `Elm.Xyzzy.embed` in a Phoenix app

2016-07-29 Thread OvermindDL1
See my answer to just this specific question at https://elixirforum.com/t/bootstrap-show-hide-operations-do-nothing-in-phoenix-app/1212/21?u=overminddl1 if anyone else happens to come by this thread. :-) On Friday, July 29, 2016 at 3:42:36 PM UTC-6, Brian Marick wrote: > > (A Phoenix newbie

[elm-discuss] Multiple uses of `Elm.Xyzzy.embed` in a Phoenix app

2016-07-29 Thread Brian Marick
(A Phoenix newbie here, and an *extreme* Elm newbie.) There are several Elm + Phoenix examples out there (though most of them for 0.16). However, I haven't found any that should more than one use of `embed`. Just to get started, I'm trying to embed Elm on two pages. On one page, it's just

Re: [elm-discuss] How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
Thanks, Duane; that looks promising. I'll try that out. On Jul 29, 2016, 4:54 PM -0400, Duane Johnson , wrote: > I wonder if the `json-to-elm` project includes what you're looking for. I see > a Types.elm (http://Types.elm) file that includes a toValue function: > > >

Re: [elm-discuss] How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Duane Johnson
I wonder if the `json-to-elm` project includes what you're looking for. I see a Types.elm file that includes a toValue function: toValue : String -> Json.Value > toValue = > Native.Types.toValue > And in the Native.Types module, a definition of toValue that uses native javascript: var

Re: [elm-discuss] Re: How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
Yes, I can see that. What I was looking for is instead a function that says "take the string you give me and give me a Json.Value." It looks like my only alternative is instead to create the Json.Value out of a complex nested structure of Json.Encode.object, and corresponding Elm tuples,

[elm-discuss] Re: How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
Spoke too soon; that doesn't work. For example: > foo = Json.Encode.string "[]" "[]" : Json.Encode.Value > bar = Json.Decode.decodeValue (Json.Decode.list Json.Decode.string) foo Err "Expecting a List but instead got: \"[]\"" : Result.Result String (List String) On Friday, July 29, 2016

[elm-discuss] Re: How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
To answer my own question -- it looks like Native.Json has an identity function which does just what I want, but which I can't import. However, it also looks like many of Json.Encode's functions just call Native.Json.identity. So this works: data = Encode.string complicatedNestedJson On

[elm-discuss] How to test JSON decoding when you need a raw Json Value?

2016-07-29 Thread Paul Blair
I'm using the nested Elm architecture pattern in an application. The nested components respond to messages coming in on a port. The messages are handled by the top-level component before being handed on to the nested components. So the outer data structure looks something like this: type alias

[elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-29 Thread John Bugner
Btw, when using (:::) this way, it's nice to set the operator precedence to something lower than 9 so you can say `2 * 5 + 3 ::: radians` without having to put brackets around the numbers. I think `infix 5 :::` gives the right precedence; Looking at the core docs (

[elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-29 Thread John Bugner
I like the clever use of the (:::) function to make its function argument (somewhat) look like a type. On Friday, July 29, 2016 at 11:48:26 AM UTC-5, Anton Lorenzen wrote: > > I just created a small library for this: > https://github.com/anfelor/elm-units > > It allows for time to be used like

Re: [elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-29 Thread Duane Johnson
On Fri, Jul 29, 2016 at 10:48 AM, Anton Lorenzen wrote: > I just created a small library for this: > https://github.com/anfelor/elm-units > > It allows for time to be used like this: > Units.Time.every (30 ::: milliseconds) Tick > Neat! I'm surprised at what can be done with

[elm-discuss] Re: Search Selection widget

2016-07-29 Thread Zeljko Nesic
Sorry, for being unclear and imprecise. I have tried to implement that behavior, but it seems that there is no neat way to do it. I have searched elm-discuss, and even though many wanted feature that will enable this kind of things, it seems there is no clear way to do it. I can imagine some

[elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-29 Thread OvermindDL1
Yep, that is why I like the style that you can do with current code. :-) On Friday, July 29, 2016 at 6:35:46 AM UTC-6, John Bugner wrote: > > Also, thinking about this further, any definition of conversions between > types is probably best expressed as a function, because a conversion is not >

[elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-29 Thread John Bugner
>This would be a nice fix to the Radians / Degrees issue too. Every language seems to settle on one or the other as "the base unit" but newcomers have to learn the assumption or face bad accidental outputs. Yes, `degrees`, `radians`, and `turns` in `Basics` suffer the same problem. >F# is kind

[elm-discuss] Re: programWithFlags for App using elm-mdl

2016-07-29 Thread Robert Walter
A better way to this is to use Maybe_s: main : Program (Maybe Flags) main = App.programWithFlags { init = init , view = view , update = update , subscriptions = subscriptions } init : Maybe Flags -> ( AppState, Cmd Msg ) init maybeFlags = let

[elm-discuss] Re: programWithFlags for App using elm-mdl

2016-07-29 Thread Robert Walter
Oh man, I just found that out as well. Thank you. So, I changed it like so: type alias AppState = { mdl : Material.Model , viewSelected : Int , ... , titleEditable : Bool , refreshEditorContent : Bool } type alias Flags = { viewSelected : Int , ... ,

Re: [elm-discuss] Re: Is there a way to investigate a Html tree?

2016-07-29 Thread Peter Damoc
Hi Yousuke, This looks like something I could use to inspect for classes. Thank you! I will investigate further. On Thu, Jul 28, 2016 at 6:56 PM, Yosuke Torii wrote: > Recently I wrote a little parser for `toString` representation. > > >

[elm-discuss] Re: programWithFlags for App using elm-mdl

2016-07-29 Thread Sergey Skrynnikov
Hi Robert, your flags don't have to be of the same type as the model - try modifying your 'init' function to take only your partial state and return (Model, Cmd Msg). пятница, 29 июля 2016 г., 14:14:39 UTC+3 пользователь Robert Walter написал: > > Hello, > > I try to initialize my elm

[elm-discuss] programWithFlags for App using elm-mdl

2016-07-29 Thread Robert Walter
Hello, I try to initialize my elm application using programWithFlags. My app makes use of elm-mdl, so my model looks something like this: type alias AppState = { mdl : Material.Model , viewSelected : Int , ... , titleEditable : Bool , refreshEditorContent : Bool } In

Re: [elm-discuss] Re: Collecting use cases for File, ArrayBuffer and TypedArrays/DataViews

2016-07-29 Thread Peter Damoc
I need to upload user avatar image and company logo. :) On Fri, Jul 29, 2016 at 11:54 AM, Michael B wrote: > ..and it's for an audio programming language, so the ability to read and > write binary data would be fantastic. > > -- > You received this message because you are

[elm-discuss] Re: Form with union type

2016-07-29 Thread Simone Vittori
Oh I see! Makes totally sense :) Thank you very much! On Thursday, 28 July 2016 17:32:13 UTC+1, Yosuke Torii wrote: > > Hi Simone, > > I wrote the fixed version here > (copy & > paste to Try Elm ). >

[elm-discuss] Re: Collecting use cases for File, ArrayBuffer and TypedArrays/DataViews

2016-07-29 Thread Michael B
..and it's for an audio programming language, so the ability to read and write binary data would be fantastic. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[elm-discuss] Re: Collecting use cases for File, ArrayBuffer and TypedArrays/DataViews

2016-07-29 Thread Michael B
I'm making a browser based IDE, so support for the FileReader API is essential for opening local files. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[elm-discuss] Re: Collecting use cases for File, ArrayBuffer and TypedArrays/DataViews

2016-07-29 Thread John Watson
Hi, Daniel, thanks for starting this off. One thing I'd like to add: *Binary Base64 decoders.* These could obviously be for any binary resource that is smuggled into elm as text. In my case I need to reconstitute soundfonts that are available as base64 encoded resources embedded in JSON.