Re: [elm-discuss] trying to draw a diagram about elm-architecture

2016-05-30 Thread 诺铁
oh yes, I've corrected it, thanks!

On Tue, May 31, 2016 at 1:09 PM, Janis Voigtländer <
janis.voigtlaen...@gmail.com> wrote:

> Looks very accurate to me. Instead of state and State, probably use model
> and Model, since that’s the terms used officially.
> ​
>
> 2016-05-31 5:14 GMT+02:00 诺铁 :
>
>> hi,
>>
>> I've tried out examples in http://guide.elm-lang.org/  , now I want to
>> prepare myself to share what I've learnt to my team mates.
>>
>> since there isn't an official diagram about the elm-architecure(maybe
>> there is?), so I draw my own.
>> https://raw.githubusercontent.com/notyy/learn_elm/master/elm_arch.png
>>
>> review is very much welcome. I hope my diagram won't be miss leading
>> others.
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Download elm

2016-05-30 Thread Janis Voigtländer
Actually what I said about elm-reactor is not necessarily true anymore (it
was before 0.17). You could try to include that into the build as well.
​

2016-05-31 7:47 GMT+02:00 Janis Voigtländer :

> Here is what you can do (if you have at least GHC 7.10 and cabal 1.18 on
> that machine, and if cabal had a chance to update its package cache at
> least once recently on that machine, by running cabal update, which
> itself requires internet access):
>
> Create the following directory structure:
>
> Elm-Platform\
> Elm-Platform\elm-compiler
> Elm-Platform\elm-package
> Elm-Platform\elm-make
> Elm-Platform\elm-repl
>
> The contents of these directories you get by downloading the 0.17 release
> zips from GitHub. For example, up front download
> https://github.com/elm-lang/elm-compiler/archive/0.17.0.zip, unzip it,
> and rename the contained directory elm-compiler-0.17.0 into simply
> elm-compiler.
>
> Then, inside the Elm-Platform directory run:
>
> cabal sandbox init
> cabal sandbox add-source elm-compiler
> cabal sandbox add-source elm-package
> cabal sandbox add-source elm-make
> cabal sandbox add-source elm-repl
> cabal install -j --only-dependencies --ghc-options="-w" elm-compiler 
> elm-package elm-make elm-repl
> cabal install -j elm-compiler elm-package elm-make elm-repl
>
> This will not give you elm-reactor. It’s simply impossible to build that
> without internet access during the build.
>
> Also, even after you have successfully installed the above way without
> internet access, actually using the tools will require internet access for
> elm-package to download stuff. But you can prepare Elm project
> directories on another machine, install packages there, then move them over
> to the machine without internet access.
> ​
>
> 2016-05-31 6:34 GMT+02:00 Nikhil Dhar :
>
>> Yes ,,
>>>
>> Actually I have to build this without using internet ,,,
>> and Buildfromsource.hs uses internet while running
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Download elm

2016-05-30 Thread Janis Voigtländer
Here is what you can do (if you have at least GHC 7.10 and cabal 1.18 on
that machine, and if cabal had a chance to update its package cache at
least once recently on that machine, by running cabal update, which itself
requires internet access):

Create the following directory structure:

Elm-Platform\
Elm-Platform\elm-compiler
Elm-Platform\elm-package
Elm-Platform\elm-make
Elm-Platform\elm-repl

The contents of these directories you get by downloading the 0.17 release
zips from GitHub. For example, up front download
https://github.com/elm-lang/elm-compiler/archive/0.17.0.zip, unzip it, and
rename the contained directory elm-compiler-0.17.0 into simply elm-compiler.

Then, inside the Elm-Platform directory run:

cabal sandbox init
cabal sandbox add-source elm-compiler
cabal sandbox add-source elm-package
cabal sandbox add-source elm-make
cabal sandbox add-source elm-repl
cabal install -j --only-dependencies --ghc-options="-w" elm-compiler
elm-package elm-make elm-repl
cabal install -j elm-compiler elm-package elm-make elm-repl

This will not give you elm-reactor. It’s simply impossible to build that
without internet access during the build.

Also, even after you have successfully installed the above way without
internet access, actually using the tools will require internet access for
elm-package to download stuff. But you can prepare Elm project directories
on another machine, install packages there, then move them over to the
machine without internet access.
​

2016-05-31 6:34 GMT+02:00 Nikhil Dhar :

> Yes ,,
>>
> Actually I have to build this without using internet ,,,
> and Buildfromsource.hs uses internet while running
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] trying to draw a diagram about elm-architecture

2016-05-30 Thread Janis Voigtländer
Looks very accurate to me. Instead of state and State, probably use model
and Model, since that’s the terms used officially.
​

2016-05-31 5:14 GMT+02:00 诺铁 :

> hi,
>
> I've tried out examples in http://guide.elm-lang.org/  , now I want to
> prepare myself to share what I've learnt to my team mates.
>
> since there isn't an official diagram about the elm-architecure(maybe
> there is?), so I draw my own.
> https://raw.githubusercontent.com/notyy/learn_elm/master/elm_arch.png
>
> review is very much welcome. I hope my diagram won't be miss leading
> others.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Download elm

2016-05-30 Thread Nikhil Dhar

>
> Yes ,,
>
Actually I have to build this without using internet ,,,
and Buildfromsource.hs uses internet while running 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] trying to draw a diagram about elm-architecture

2016-05-30 Thread 诺铁
hi,

I've tried out examples in http://guide.elm-lang.org/  , now I want to
prepare myself to share what I've learnt to my team mates.

since there isn't an official diagram about the elm-architecure(maybe there
is?), so I draw my own.
https://raw.githubusercontent.com/notyy/learn_elm/master/elm_arch.png

review is very much welcome. I hope my diagram won't be miss leading others.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] effect module … where {…} exposing …

2016-05-30 Thread Vitor Capela
Witold,

I believe the docs will eventually be in
http://guide.elm-lang.org/effect_managers/. As far as I understand them,
they allow a library author to describe how side-effects happen, letting
the runtime bridge your purely functional code and the messy world around
it. Some descriptions of the API lie here:
http://package.elm-lang.org/packages/elm-lang/core/4.0.1/Platform

Best,

Vitor.
Em seg, 30 de mai de 2016 às 19:24, Witold Szczerba 
escreveu:

> Hi,
> I am looking at:
>
> https://github.com/evancz/elm-architecture-tutorial/blob/master/examples/6-clock.elm
>
> … and trying to figure out what's going on there. The official guide does
> not cover this, I guess it's because it's a work in progress for 0.17.
>
> So, there is:
>
> subscriptions : Model -> Sub Msg
> subscriptions model =
>   Time.every second Tick
>
> and the subscription is "picked" by
> Html.program's
> { ..., subscriptions: subscriptions ... }
>
> That part seems easy: "someone" (aka the Html Framework) just fires the
> thing and the timer begins to tick. So far so good, but I was wondering
> what Time.every is… The Time.elm starts like this:
>
> effect module Time where { subscription = MySub } exposing […]
>
> What does "effect module" mean? I tried to find this in
> http://elm-lang.org/docs (Syntax, Package Design), but it's not there. Is
> it something so new it's just not there yet or I can't find it? What does
> it mean? Is it something very special, part of Elm's syntax, or is it just
> an instance of some template/generic kind of module?
>
> Thanks,
> Witold Szczerba
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Graph of Elm contributors

2016-05-30 Thread David Legard
Well, 'velocity' is simply the slope of each of the line at any time, = 
d(Commit)/dT

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] effect module … where {…} exposing …

2016-05-30 Thread Witold Szczerba
Hi,
I am looking at:
https://github.com/evancz/elm-architecture-tutorial/blob/master/examples/6-clock.elm

… and trying to figure out what's going on there. The official guide does
not cover this, I guess it's because it's a work in progress for 0.17.

So, there is:

subscriptions : Model -> Sub Msg
subscriptions model =
  Time.every second Tick

and the subscription is "picked" by
Html.program's
{ ..., subscriptions: subscriptions ... }

That part seems easy: "someone" (aka the Html Framework) just fires the
thing and the timer begins to tick. So far so good, but I was wondering
what Time.every is… The Time.elm starts like this:

effect module Time where { subscription = MySub } exposing […]

What does "effect module" mean? I tried to find this in
http://elm-lang.org/docs (Syntax, Package Design), but it's not there. Is
it something so new it's just not there yet or I can't find it? What does
it mean? Is it something very special, part of Elm's syntax, or is it just
an instance of some template/generic kind of module?

Thanks,
Witold Szczerba

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Is it correct way to get DOM to function?

2016-05-30 Thread Юрий Яковенко
Hello all

Sorry i'm new in Elm, could you clarify

I've made exercise in *checkboxes *example, please review it, Am i in right 
way?

import Html exposing (..)
import Html.App exposing (beginnerProgram)
import Html.Attributes exposing (..)
import Html.Events exposing (onCheck)

main =
  beginnerProgram { model = model, view = view, update = update }

-- MODEL

type alias Model =
  { red : Bool
  , underline : Bool
  , bold : Bool
  }

model : Model
model =
  Model False False True

-- UPDATE

type Msg
  = Red Bool
  | Underline Bool
  | Bold Bool

update : Msg -> Model -> Model
update msg model =
  case msg of
Red bool ->
{ model | red = bool }

Underline bool ->
{ model | underline = bool }

Bold bool ->
{ model | bold = bool }

-- VIEW

view : Model -> Html Msg
view model =
  let
myLabel: Bool -> ( Bool -> Msg ) -> Html Msg
myLabel newChecked event =
  label []
[ br [] []
, input [ type' "checkbox", checked newChecked, onCheck event ] []
, text "red"
]
  in 
div []
  [ span [toStyle model] [ text "Hello, how are you?!"]
  , myLabel model.red Red
  , myLabel model.underline Underline
  , myLabel model.bold Bold 
  ]


toStyle : Model -> Attribute msg
toStyle model =
  style
[ ("color", if model.red then "red" else "black")
, ("text-decoration", if model.underline then "underline" else "none")
, ("font-weight", if model.bold then "bold" else "normal")
]

-- Exercise: move the repetative code in `view` into a separate function
-- and use it three times.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Dynamically load SVG files

2016-05-30 Thread Zinggi
Couldn't you just use an img tag with the path/to.svg in the src attribute?


On Monday, 30 May 2016 15:34:07 UTC+2, Håkon Rossebø wrote:
>
> I'm trying out some SVG maps from here:
>
> https://www.amcharts.com/svg-maps/?map=usa
>
> Seems to be too much to embed inline. What would be the best way of 
> loading SVG files dynamically?
>
>
>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Cannot get elm-community/elm-test to work as advertised on the command line

2016-05-30 Thread kgashok
I followed the updated article at 
https://medium.com/@_rchaves_/testing-in-elm-93ad05ee1832#.u0cv82yl8 - but 
when I run 
node tests.js

I get the following error: 


 onDocument: F3(on(document)),
  ^
ReferenceError: document is not defined
at /home/ashokb/hero/hello/tests/tests.js:7822:20
at Object. (/home/ashokb/hero/hello/tests/tests.js:7826:2)
at Object. (/home/ashokb/hero/hello/tests/tests.js:9487:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:945:3







On Friday, 27 May 2016 08:03:51 UTC+5:30, Ray Toal wrote:
>
> Hello
>
> I'm doing lots of updating from 0.16 to 0.17 and since Graphics.Element 
> was moved out of core, I figured it was time to ditch ElementRunner and do 
> some nice command line testing. This is great because I have a ton of files 
> with tests in them and would like to just run them all on the command line.
>
> I noticed that we now have elm-community/elm-test instead of 
> deadfoxygrandpa/elm-test.
>
> I went straight to the command line example here: 
>
> 
> https://github.com/elm-community/elm-test#testing-from-the-command-line
>
> This example looked great so I made a file with it and did exactly what it 
> told me to do but I got errors:
>
> $ *cat Tests.elm*
>
> module Tests exposing (..)
>
>
> import ElmTest exposing (..)
>
>
> tests : Test
>
> tests =
>
> suite "A Test Suite"
>
> [ test "Addition" (assertEqual (3 + 17) 10)
>
> , test "String.left" (assertEqual "a" (String.left 1 "abcdefg"))
>
> , test "This test should fail" (assert False)
>
> ]
>
>
> main : Program Never
>
> main =
>
> runSuite tests
>
>  
>
> $ *elm-make Tests.elm --output tests.js*
>
> Success! Compiled 10 modules.   
>
> elm-make: 
> elm-stuff/build-artifacts/0.17.0/elm-community/elm-test/1.1.0/ElmTest-Runner-Console.elmo:
>  
> openFile: does not exist (No such file or directory)
>
>  
>
> $ *node tests.js*
>
> tests.js:3552
>
> });
>
>   ^
>
> SyntaxError: Unexpected end of input
>
> at Object.exports.runInThisContext (vm.js:53:16)
>
> at Module._compile (module.js:513:28)
>
> at Object.Module._extensions..js (module.js:550:10)
>
> at Module.load (module.js:458:32)
>
> at tryModuleLoad (module.js:417:12)
>
> at Function.Module._load (module.js:409:3)
>
> at Function.Module.runMain (module.js:575:10)
>
> at startup (node.js:160:18)
>
> at node.js:449:3
>
>
> Errors! So I don't have an ElmTest-Runner-Console.elmo and the generated 
> JavaScript is broken.
>
> Has anyone else noticed this? If so, great. If not, I guess I would have 
> to figure out what is going on and do the fix and make the pull request, 
> but am on a bit of a tight schedule and was hoping perhaps this was a known 
> issue with a workaround, OR I'm just all messed up with my Elm 
> configuration.
>
> I am using node 6.2.0, Elm 0.17.0 installed from Homebrew and my 
> elm-package.json contains:
>
> "exposed-modules": [],
>
> "dependencies": {
>
> "elm-community/elm-test": "1.1.0 <= v < 2.0.0",
>
> "elm-lang/core": "4.0.0 <= v < 5.0.0",
>
> "elm-lang/html": "1.0.0 <= v < 2.0.0",
>
> "evancz/elm-http": "3.0.1 <= v < 4.0.0",
>
> "evancz/elm-markdown": "3.0.0 <= v < 4.0.0"
>
> },
>
> "elm-version": "0.17.0 <= v < 0.18.0"
>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] elm-stuff causing troubles after each updates

2016-05-30 Thread Noah Hall
Share your elm-package.json. we have had this problem at NRI, and the
tooling under https://github.com/NoRedInk/elm-ops-tooling#elm_deps_check
help to maintain consistency of the elm-stuff folder

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Graph of Elm contributors

2016-05-30 Thread B M Corser
I originally posted this on the IRC channel, but thought I would share it 
here as well.

https://bmcorser.github.io/assets/html/elm-packages/

The above links to a line graph that attempts to show the "velocity" of Elm 
as a whole.

Right now it shows that Evan is making loads of commits and there are 
starting to be quite a few developers getting interested too. I'll re-run 
the scripts I used to generate the graph periodically, so it might be 
interesting to check back in a few weeks time.

Also, if anyone has any ideas about how the graph could show "velocity" a 
bit better, I'm all ears. Right now it just shows the cumsum of commits by 
contributor ...

Salut,

Ben

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Download elm

2016-05-30 Thread Joey Eremondi
I'm confused what the actual problem is.

You need to use internet to get Elm. Are you in a situation where you're
behind a proxy? The npm page I linked gives instructions for how to deal
with that.

If you want to build them yourself, you need to download elm-compiler,
elm-make, and elm-package from GitHub, as well as elm-reactor and elm-repl
if you want.
Then you need to compile them in the same Cabal sandbox.

You can look at this file to see what's actually going on:
https://github.com/elm-lang/elm-platform/blob/master/installers/BuildFromSource.hs

It fetches the packages from GitHub, the builds them in the correct order.
You could fetch them yourself, then edit the script to only build them.

On Mon, May 30, 2016 at 10:48 AM, Nikhil Dhar 
wrote:

> ya I am on linux  npm also uses internet while downloading,,
>>
> correct me If I am wrong  ,,,I think there is only one way I need to
> download all packages first then make a script file and run that file
>
>>
>>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Download elm

2016-05-30 Thread Nikhil Dhar

>
> ya I am on linux  npm also uses internet while downloading,,
>
correct me If I am wrong  ,,,I think there is only one way I need to 
download all packages first then make a script file and run that file  

>  
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Download elm

2016-05-30 Thread Joey Eremondi
Are you on Linux?
BuildFromSource needs Internet access because it is fetching several
different projects from github.

You could try using the npm installer: https://www.npmjs.com/package/elm
Want to install elm from source already tried with buildfromsource.hs but
it also connects with internet.
Is there any way so I can run the script and install elm offline or if
there is all packages available to someone which  buildfromsource.hs
downloads please send it to me..

Thanks ,,,

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Dynamically load SVG files

2016-05-30 Thread Max Goldstein
Make an HTTP request in init, and have a Msg where they get added to the 
model. If you work through some tutorials (links conspicuously absent!) on 
the Elm Architecture, this should become pretty clear.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Is Msg a type or a type constructor?

2016-05-30 Thread Max Goldstein
Msg is a concrete type, yes, but it doesn't have to be as simple as Int. 
This is perfectly reasonable:

type Msg = Resize Window.Size | Tick Time | Click Mouse.Position | NoOp

Just as long as there are no lowercase type variables.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Update 2 Child Components with Msg from 1

2016-05-30 Thread David
Perfect! That worked. Thanks for the link describing how to import union 
type constructors.

On Monday, May 30, 2016 at 2:04:21 AM UTC-5, Janis Voigtländer wrote:
>
>
> http://elm-community.github.io/elm-faq/#why-when-i-import-a-module-that-defines-a-type-does-the-compiler-know-about-the-type-name-but-not-its-constructors
> ​
>
> 2016-05-30 8:44 GMT+02:00 David >:
>
>> Thank you, Peter. You've described a nice solution. 
>>
>> The problem I'm having, though is that when I try to send Child2.someMsg the 
>> compiler tells me that `Child2` does not expose `someMsg`. I am, however 
>> exposing it in the module shown in the code below. 
>>
>> How does one create a Msg to then send to Child2? It appears that even 
>> though it's exposed it's not recognized in the parent module.
>>
>> Relevant code:
>>
>> module Child2 exposing (Msg, Model, view, update, model)
>> ...
>>
>> -- Msg Union Type Definition Child2
>>
>> type Msg =
>>   SomeMsg
>>   | NoOp
>>
>>
>>
>>
>> On Monday, May 30, 2016 at 1:22:26 AM UTC-5, Peter Damoc wrote:
>>>
>>> You have multiple ways to address this, depending on the role or the ID. 
>>>
>>> If the ID is just an identifier of the child, it should not be in the 
>>> child because it has nothing to do with the child functionality. It should 
>>> be in the parent, similar to the way CounterList is implemented in the 
>>> tutorial. Once it is in the parent, your problem becomes very simple since 
>>> you will have access to the ID in the parent `update`
>>>
>>> If, for some reason, you need to keep the id inside the child, you can 
>>> expose an interrogation API on the model 
>>>
>>> case of msg
>>> UpdateFromChild1 msg ->
>>> let 
>>> newChild1 = Child1.update msg model.child1
>>> id = Child1.id model.child1 
>>> c2msg = Child2.someMsgForId id 
>>> newChild2 = Child2.update c2msg model.child2 
>>> in 
>>> { model | child1 = newChild1, child2 = newChild2 }
>>>
>>> And in Child1.elm have
>>>
>>> id model = model.id 
>>>
>>> in Child2.elm have 
>>>
>>> someMsgForId id = SomeMsg id 
>>>
>>> Approaching things like this ensure that you are not needlessly coupling 
>>> Child1 and Child2 code. 
>>>
>>>  
>>>
>>>
>>>
>>>
>>> On Mon, May 30, 2016 at 4:06 AM, David  wrote:
>>>
 Hi,

 I'm new at this too and just experimenting. The model structured is 
 presented below. I don't think it has much to do with the model, but more 
 to do with the fact that the update in Child2 is expecting a Child2.Msg, 
 but is instead receiving a Child1.Msg. 

 Model Child2
 ---
 model =
   {  id: Int
, name: String
, description: String
   } 



 On Sunday, May 29, 2016 at 4:12:59 PM UTC-5, Witold Szczerba wrote:
>
> Hi,
> I am just experimenting with Elm, haven't done anything yet, so I will 
> be watching how this thread evolves. Looking at your case, I have but one 
> question: what's the model of the component you have problem with?
>
> Regards,
> Witold Szczerba
> 29 maj 2016 21:06 "David"  napisał(a):
>
> I need to update 2 child components based on the Action/Msg of 1 child 
> component. How would I do this?
>
> The UpdateFromChild1 contains a Child1.Msg, which contains an id. I'd 
> like to send the id to the models of Child1 update *and* to Child2 
> update. 
>
> Code:
>
> Main update
> ---
> update msg model = 
>   case of msg
> UpdateFromChild1 msg ->
>   Child1.update msg Child1.model < works, update gets correct 
> message with id
>   Child2.update *msg* Child2.model < does not work, obviously
>  ^-- somehow change this to 
> (Child2.Msg id)?
>UpdateFromChild2 msg ->
>  -- stuff only child 2 cares about
>
>
>
> Main view
> ---
> view model = 
>   div [] 
>   [ App.map UpdateFromChild1 (Child1.view Child1.model)
>   , App.map UpdateFromChild2 (Child2.view Child2.model)
>   ]
>
> -- 
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> -- 
 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...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>> There is NO FATE, we are the creators.
>>> blog: http://damoc.ro/
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Elm Discuss" group.
>> To unsubscribe fro

[elm-discuss] Dynamically load SVG files

2016-05-30 Thread Håkon Rossebø
I'm trying out some SVG maps from here:

https://www.amcharts.com/svg-maps/?map=usa

Seems to be too much to embed inline. What would be the best way of loading 
SVG files dynamically?




-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Import module from src directory in elm-repl

2016-05-30 Thread Shump
Hi Nick!

I got curious when you said that you couldn't reproduce the problem so I 
tried to do the same in another folder, and I was unable to reproduce the 
problem as well. After spending some time in my main project, removing 
lines to narrow down the problem, I managed to get my main project to work 
with the repl! I'm still not sure what broke and why, but it seems it got 
fixed when I removed the elm-stuff folder. I suppose there were some cache 
somewhere screwing with the repl :/

Thank you all for trying to help!

On Saturday, May 28, 2016 at 4:45:27 AM UTC+9, Nick H wrote:
>
> Three questions:
>
> 1. What happens if you run
>
> rm -rf elm-stuff/build-artifacts
>
> And then try elm-repl again?
>
> 2. Would you mind sharing your entire elm-package.json?
>
> 3. Is 0.17 the only version of Elm you have installed?
>
> I wasn't able to reproduce your problem, so I am just trying to get more 
> info.
>
>
> On Fri, May 27, 2016 at 5:20 AM, Shump 
> > wrote:
>
>> My elm-package.json has the following entry:
>> ...
>> "source-directories": [
>> "src"
>> ],
>> ...
>>
>> and my directory looks like this (minus elm-stuff folder in the root)
>> .
>> ├── build
>> │   └── MyModule.js
>> ├── elm-package.json
>> ├── index.html
>> └── src
>> └── MyModule.elm
>>
>> and I try to launch elm-repl from the root with no parameters. In the 
>> repl I try to import with `import MyModule` which reports:
>> elm-make: elm-stuff/build-artifacts/0.17.0/user/project/1.0.0/Repl.elmo: 
>> openFile: does not exist (No such file or directory)
>>
>>
>>
>> On Thursday, May 26, 2016 at 11:26:46 PM UTC+9, Max Goldstein wrote:
>>>
>>> Have a look at elm-package.json. It lists the source directories, and 
>>> probably had . instead of ./src. 
>>
>> -- 
>> 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...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Is Msg a type or a type constructor?

2016-05-30 Thread Peter Damoc
Msg is like the Int in your description, it is a concrete type.
`Html` and `Sub` are type constructors that take `Msg` and produce concrete
types.





On Mon, May 30, 2016 at 1:25 PM, Peter Kohout  wrote:

> Really struggling with this question.
> We can have Html Msg   and Sub Msg.
> coming from some haskell background can I think of Msg as Maybe ie data
> Maybe a = Nothing | Just a or as Int
> Thanking in advace.
>
>
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Is Msg a type or a type constructor?

2016-05-30 Thread Peter Kohout
Really struggling with this question.
We can have Html Msg   and Sub Msg.
coming from some haskell background can I think of Msg as Maybe ie data 
Maybe a = Nothing | Just a or as Int
Thanking in advace.



-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Download elm

2016-05-30 Thread Nikhil Dhar
Want to install elm from source already tried with buildfromsource.hs but 
it also connects with internet.
Is there any way so I can run the script and install elm offline or if 
there is all packages available to someone which  buildfromsource.hs 
downloads please send it to me..

Thanks ,,,

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Update 2 Child Components with Msg from 1

2016-05-30 Thread Janis Voigtländer
http://elm-community.github.io/elm-faq/#why-when-i-import-a-module-that-defines-a-type-does-the-compiler-know-about-the-type-name-but-not-its-constructors
​

2016-05-30 8:44 GMT+02:00 David :

> Thank you, Peter. You've described a nice solution.
>
> The problem I'm having, though is that when I try to send Child2.someMsg the
> compiler tells me that `Child2` does not expose `someMsg`. I am, however
> exposing it in the module shown in the code below.
>
> How does one create a Msg to then send to Child2? It appears that even
> though it's exposed it's not recognized in the parent module.
>
> Relevant code:
>
> module Child2 exposing (Msg, Model, view, update, model)
> ...
>
> -- Msg Union Type Definition Child2
>
> type Msg =
>   SomeMsg
>   | NoOp
>
>
>
>
> On Monday, May 30, 2016 at 1:22:26 AM UTC-5, Peter Damoc wrote:
>>
>> You have multiple ways to address this, depending on the role or the ID.
>>
>> If the ID is just an identifier of the child, it should not be in the
>> child because it has nothing to do with the child functionality. It should
>> be in the parent, similar to the way CounterList is implemented in the
>> tutorial. Once it is in the parent, your problem becomes very simple since
>> you will have access to the ID in the parent `update`
>>
>> If, for some reason, you need to keep the id inside the child, you can
>> expose an interrogation API on the model
>>
>> case of msg
>> UpdateFromChild1 msg ->
>> let
>> newChild1 = Child1.update msg model.child1
>> id = Child1.id model.child1
>> c2msg = Child2.someMsgForId id
>> newChild2 = Child2.update c2msg model.child2
>> in
>> { model | child1 = newChild1, child2 = newChild2 }
>>
>> And in Child1.elm have
>>
>> id model = model.id
>>
>> in Child2.elm have
>>
>> someMsgForId id = SomeMsg id
>>
>> Approaching things like this ensure that you are not needlessly coupling
>> Child1 and Child2 code.
>>
>>
>>
>>
>>
>>
>> On Mon, May 30, 2016 at 4:06 AM, David  wrote:
>>
>>> Hi,
>>>
>>> I'm new at this too and just experimenting. The model structured is
>>> presented below. I don't think it has much to do with the model, but more
>>> to do with the fact that the update in Child2 is expecting a Child2.Msg,
>>> but is instead receiving a Child1.Msg.
>>>
>>> Model Child2
>>> ---
>>> model =
>>>   {  id: Int
>>>, name: String
>>>, description: String
>>>   }
>>>
>>>
>>>
>>> On Sunday, May 29, 2016 at 4:12:59 PM UTC-5, Witold Szczerba wrote:

 Hi,
 I am just experimenting with Elm, haven't done anything yet, so I will
 be watching how this thread evolves. Looking at your case, I have but one
 question: what's the model of the component you have problem with?

 Regards,
 Witold Szczerba
 29 maj 2016 21:06 "David"  napisał(a):

 I need to update 2 child components based on the Action/Msg of 1 child
 component. How would I do this?

 The UpdateFromChild1 contains a Child1.Msg, which contains an id. I'd
 like to send the id to the models of Child1 update *and* to Child2
 update.

 Code:

 Main update
 ---
 update msg model =
   case of msg
 UpdateFromChild1 msg ->
   Child1.update msg Child1.model < works, update gets correct
 message with id
   Child2.update *msg* Child2.model < does not work, obviously
  ^-- somehow change this to
 (Child2.Msg id)?
UpdateFromChild2 msg ->
  -- stuff only child 2 cares about



 Main view
 ---
 view model =
   div []
   [ App.map UpdateFromChild1 (Child1.view Child1.model)
   , App.map UpdateFromChild2 (Child2.view Child2.model)
   ]

 --
 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...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

 --
>>> 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...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> There is NO FATE, we are the creators.
>> blog: http://damoc.ro/
>>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsub