Giter Site home page Giter Site logo

elm / elm-lang.org Goto Github PK

View Code? Open in Web Editor NEW
2.0K 74.0 367.0 18.39 MB

Server and client code for the Elm website.

Home Page: http://elm-lang.org/

License: BSD 3-Clause "New" or "Revised" License

Elm 46.51% CSS 3.05% HTML 10.46% Shell 0.66% JavaScript 39.32%
elm homepage website blog

elm-lang.org's Introduction

Elm Home Page

All of elm-lang.org is written in Elm!

Build Instructions

Running bash build.sh should generate the static website in _site.

After that, you can run (cd _site ; elm reactor) to see it at http://localhost:8000 in your browser. Not all the links work with this setup, but you should be able to get to all the pages nonetheless!

elm-lang.org's People

Contributors

aforemny avatar akeeton avatar amitaibu avatar andybalaam avatar apanatshka avatar brianhicks avatar cassiebaer avatar deadfoxygrandpa avatar dobesv avatar evancz avatar ggreif avatar hogjosh avatar hoosieree avatar inchingforward avatar joecan avatar jvoigtlaender avatar madscoaducom avatar maxsnew avatar mhr avatar michaelbjames avatar michalisk avatar miller-time avatar moleculezz avatar process-bot avatar slava-sh avatar soupi avatar terezka avatar thsoft avatar tomberek avatar uehaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elm-lang.org's Issues

0.12: Decrementing `Touch.Touch` IDs

I've noticed that each touch propagated by Touch.touches yields a Touch with ID 1 less than the previous one. How come they don't increment instead?

Broken link to walkthrough on Graphics.Input

The Graphics.Input page says:

"See the walkthrough on Graphics.Input to get a better understanding of how this library works and why it is designed this way."

and the contained link on "the walkthrough on Graphics.Input" just points to:

http://elm-lang.org/

Menu is served by elm-mini.js and not by Website/Skeleton.elm

Unless I missed something obvious, this is very misleading, as I was trying to change the text in the Skeleton.elm file and it would not update, and I was stuck until I grepped the whole source to find other references of "About", "Docs", etc.

As an aside, I don't see the License on the repository. I want to use it as a base to a little website and I'm not sure if I can do that for commercial purposes, and if my resulting website should be open source as well. As Jeff Atwood said, "Experienced developers won't touch unlicensed code because they have no legal right to use it."

The online editor is limited in the size of the program.

There is a limitation on how much data can be URL encoded and sent to /compile?input=

The URL is silently truncated and will usually result in a compilation error. Changing Editor.hs to use multipart/form-data for the input might help.

Minor issues on syntax page

Avoiding forking the whole repo, but on the syntax reference page:

  • The second link at the very end of Lifting 404s. Needs to use the new docs URL format.
  • The FFI says there are four built-in event handlers, but I only see three.

Very minor, fix whenever.

Add support for JavaScript's atan2 function

JavaScript has an atan2 function, which can be used to find the angle of a vector given its y and x components (in that order). Using Math.atan(y/x), you have to deal with ugly edge cases:

  • x is zero, meaning the angle is π/2 or -π/2 (that is, unless y is zero too, in which case the angle can be anything).
  • y/x eliminates the distinction between Q1/Q4 and Q3/Q2, meaning you have to see what quadrant the coordinate is in and add/subtract accordingly.

Math.atan2(y, x) will take care of this for you. I think we should add this to Elm's Prelude next to atan (I don't have time to put together a patch at the moment). By the way, Haskell has an atan2 function, too, and it works the same way.


Also, we can simplify part of the insideShape function. Here is the current code:

var angle = 2 * Math.PI * theta;
var t = x === 0 ? (y > 0 ? Math.PI/2 : -Math.PI/2) - angle
                : (Math.atan(y/x) + (x > 0 ? 0 : Math.PI)) - angle;
var r = Math.sqrt(x*x + y*y);
x = r * Math.cos(t);
y = r * Math.sin(t);

This appears to rotate x and y by -2π * theta. It turns out there is a much nicer way to rotate vectors: apply a rotation matrix. We don't need atan at all. The following formula rotates a vector "counter-clockwise" by θ:

x' = x*cos(θ) - y*sin(θ)
y' = x*sin(θ) + y*cos(θ)

When I say "counter-clockwise", I assume a coordinate system where x+ is right and y+ is up. On a computer screen, y+ is down, meaning this will actually rotate clockwise.

In general, when you have foo(bar¯¹(x)) (where foo and bar are trig functions), there's a good chance they cancel into something much nicer.

"\ue2" appears in compiler output

It looks like the Elm compiler is embedding \ue2 into the output, which isn't a valid escape sequence in HTML. As a result, the JavaScript doesn't run.

$ more Main.elm
import Mouse

main = lift asText Mouse.position

$ elm Main.elm
Generating HTML ... Done

$ tail build/Main.html
var Text = Elm.Text.make(_elm);
var Time = Elm.Time.make(_elm);
var _op = {};
var main = A2(Signal\u2elift,
Text\u2easText,
Mouse\u2eposition);
_elm.Main.values = {_op: _op
,main: main};
return _elm.Main.values;
};</script><script type="text/javascript">Elm.fullscreen(Elm.Main)</script>

$ elm --version
0.11

Possible issue: dev branch

Hi Evan,

I have noticed that this error shows up in the javascript console 4~5 secs after page load.

ReferenceError: JavaScript is not defined - Navigation.elm:19

I just wanted to mention it - I haven't seen any direct implecations from this.

Mads

Editor doesn't resolve module aliases

For example in the Password.elm you have "import Graphics.Input.Field as Field" the editor will then not show the docs for things such as Field.password which should be interpreted as Graphics.Input.Field.password.

Could not get site running

I cloned the repository and built the project.

On running command,

./run-elm-website

I get the following error.

Initializing Server
run-elm-website: build: getDirectoryContents: does not exist (No such file or directory)

Am I missing something?

Infinite list problem

list : [Int]
list = 0 :: list -- the compiler allows to write this line

hd = head list -- 0
tl = tail list -- <internal structure>

main = asText (length list) -- Runtime error: Cannot read property 'ctor' of undefined

I've found this bug here: http://elm-lang.org/try

Please add type signatures to the examples.

I spent some time trying to learn Elm this weekend, and I got stuck trying to understand what the types are supposed to be. For example, I still don't know what type main is expecting.

Could you please add type signatures to all of the examples, especially the complex examples like Mario.

Thank you.

elm-lang.org server doesn't produce html from Elm.

I just build elm-lang.org server on Windows and tried to run it, but the server serves only a blank page. The elm core stylesheets, scripts etc. are there, but content div is empty. Interesting part is that there's normal content inside the tag. I can go to /edit/Elm.elm url and use the editor, but there's no result in the left pane. I get same behaviour for elm-server.

Bad link in Graphics.Input Doc

Line 102:

description = [markdown|See [the walkthrough on `Graphics.Input`](/) to get a better understanding of how this library works and why it is designed this way.|]

In public/docs/Graphics/Input.elm is linking to a (as far as I can tell!) non-existing walkthrough. If I knew where the walkthrough was I would fix the link, but I can't seem to find it.

Argument order of foldl is NOT different from Haskell's

In the FAQ, it says

The order of arguments for foldl is deliberately different from Haskell's to improve composability.

However, it's the same:

 ~ elm-repl
> foldl (+) 0 [1,2,3]
6 : number
>
~ ghci
oλ foldl (+) 0 [1,2,3]
6
λ

JS FFI - only one of multiple send events on different channels updates it's elm signal

When trying to send JS events to the same Elm worker - but on different channels, only one event goes through.

In this example only signal_a is updated in TestModule:

var worker = Elm.worker(Elm.TestModule);

example.addEventListener("click", function () {
    worker.send("signal_a", "a");
    worker.send("signal_b", "b");
});

But if I postpone one event to the next event loop "tick" then both signals get updated:

...
works.send("signal_a", "a");
setTimeout(function() { worker.send("signal_b", "b"); }, 0);
...

suggestion : improving navigational links

I like the sites content but the navigation can be improved.

Navigational links should be present and identical across all elm sites.
They should be no more than ten (if more, we will need menus) with
one word labels (good so far).

Instead of

learn examples docs install

They should be

about try learn examples syntax operators libraries discuss

I have tried to pick the landing pages I go often and I have sometimes
trouble to find.

In the main page, the following laius is unneeded, so are the button that are too low,
so may be under the fold anyway.

"See the examples and learning resources to learn more. Join the elm-discuss list for questions, announcements, and discussion. Press a huge button to get started!"

Probably, the operator pages can be improved. I have no specific suggestion
so far.

Mac installer produces segfaulting binaries

Hello! I just downloaded Elm-Platform-0.12.3.pkg from the install page, and installed.

(As a side note: for some reason /usr/local/bin, which I believe did not exist prior since only Elm things are currently in /usr/local, was created without any access for non-superusers. I was able to fix /usr/local/bin's permissions, but it should be created with the right permissions if it doesn't exist and needs to be created.)

With permissions fixed, I tried running the executables, but get errors for all of them.

MacBook-Pro:CODE user$ elm-server
/usr/local/bin/elm-server: line 6: 999 Segmentation fault: 11 /usr/local/bin/elm-server-unwrapped $*

MacBook-Pro:CODE user$ elm HelloWorld.elm
/usr/local/bin/elm: line 6: 1002 Segmentation fault: 11 /usr/local/bin/elm-unwrapped $*

MacBook-Pro:CODE user$ elm-doc
/usr/local/bin/elm-doc: line 6: 1004 Segmentation fault: 11 /usr/local/bin/elm-doc-unwrapped $*

MacBook-Pro:CODE user$ elm-repl
/usr/local/bin/elm-repl: line 6: 1006 Segmentation fault: 11 /usr/local/bin/elm-repl-unwrapped $*

MacBook-Pro:CODE user$ elm-get
/usr/local/bin/elm-get: line 6: 1008 Segmentation fault: 11 /usr/local/bin/elm-get-unwrapped $*

The system is Mac OSX 10.7.3.

Importing hidden identifiers not reported as error

Edit: sorry, didn't realize this isn't the Elm compiler. Please close it.

Consider the following example that consists of two files:

module A where
import B(g)
main = asText g

and

module B(f) where
f = "asdf"
g = "jkl;"

Here the import of identifier g from module B by A should be illegal because B only exports f, but Elm fails to report the error and happily compiles with elm --make

The generated page, however, does not load properly: in this case I've got a page that only reads

<internal structure>

and in other cases I've seen the error

Cannot read property 'arity' of undefined
    Open the developer console for more details.

The produced error is, in my opinion, however irrelevant: it is Elm that should detect, report and refuse to compile module A because it tries to import an unexported identifier.

Slideshow example

Hi

I have tried to write a new slideshow example:

slideShow (w,h) list =
  color black . container w h middle . image 472 315 $ head list

nextImage input list = (tail list) ++ [(head list)]

img = [ "book.jpg", "shells.jpg", "stack.jpg", "car.jpg", "pipe.jpg" ]

imageList = foldp nextImage img (every (4 * second))

main = lift2 slideShow Window.dimensions imageList

I believe that it is a simplified version of the current slideshow example

Br.
Runje

"Unknown flag: --runtime" when running run-elm-website

Possibly related to elm/compiler#632?

After following the README instructions:

$ ./dist/build/run-elm-website/run-elm-website
Initializing Server
Unknown flag: --runtime
Unknown flag: --runtime
...
^CUnknown flag: --runtime
run-elm-website: build: getDirectoryContents: does not exist (No such file or directory)

Thanks!

Text field blanks out unexpectedly

Consider the following:

import Graphics.Input as Input

data Event = Nop | Create | Change Int String

fields = Input.fields Nop
buttons = Input.buttons Nop
events = merge fields.events buttons.events

btn = buttons.button Create "Create"

view : [(Element, String)] -> Element
view lst =
    let f (e,s) = e `beside` plainText s
    in flow down (btn :: map f lst)

change : Int -> (a -> a) -> [a] -> [a]
change i f l =
    case l of [] -> []
              x::xs -> if i == 0 then f x :: xs
                       else x :: change (i-1) f xs

update : Event -> [(Element,String)] -> [(Element,String)]
update evt x =
    case evt of
      Nop -> x
      Create -> x ++ [(fields.field (\fs -> Change (length x) fs.string)
                                 "write here"
                                 Input.emptyFieldState,
                       "")]
      Change i s -> change i (\(e,_) -> (e,s)) x

main = view <~ foldp update [] events

It should create a new text field whenever the "Create" button is pressed, but leaves the old text fields alone (rather than re-creating them, as a naive implementation based on counting button-presses might do).

However, when I run it under Elm 0.11, pressing the Create button actually blanks all other text fields. The text beside the field stays the same, though, until you select the text field in question, whereupon that becomes blank, too.

This behavior makes it very difficult to create a dynamic list of items containing text fields (dynamic meaning the list can be added to and removed from at runtime) that behaves properly.

Compile.sh case sensitivity error on OS X

When running compile.sh on Mac OS X 10.8, I get the following error:

mv: rename Server to ../Server: Is a directory

and it looks like the executable Server is clashing with the directory server. The executable still works from the server directory, but it should probably be changed so it installs cleanly.

combo box don't fit their inner contents

bug observed long time ago, just never reported. It happened on various configuration (school, home,..).

I already saw it on an other project (not elm-related) where someone fixed it by I don't know which trick (yeah, cool story). The point is that there should be a way to deal with this problem which is visible in a fairly large number of pc.

As usual, thanks very much for making elm. :)

http://elm-lang.org/blog/announce/0.12.3.elm crashes Firefox 29

The announcement page 0.12.3.elm loads some text and images, then instantly kills Firefox.
0.12.2.elm does the same. 0.12.1.elm and 0.12.elm are fine and do NOT crash.

Browser: 29.0.1 with HTTPS Everywhere, Ghostery, FlashBlock, Privacy Badger.
System: 3.10.39-1-MANJARO x86_64 using NVidia driver 331.67 on a GTX 660.

Stack space overflow for simple code

The following code causes an overflow when run by using elm-server (v 0.11).

import Mouse
import WebSocket
import Window
import Keyboard

struct = {word = ""}
update dir table = {table | word = "wtf"} -- notice mistake here: '=' instead of '<-'
main = asText <~ (foldp update struct Keyboard.arrows)

resource exhausted (Too many open files)

Every month or so, the server goes down with this message:

Server error: public/build/Elm.elm: openBinaryFile: resource exhausted (Too many open files)

I assume this has to do with lazy IO in the server. Sometimes you need to artificially read to the end of a file to make sure it gets closed properly. I find things like (length content seq ...) is sometimes necessary... This may be something in HAppStack as well.

documentation for `Text.link` appears incorrect

The documentation at Catalog/Elm/Text says that link has a type signature of String -> Text -> Text, but my (just-updated) elm-repl disagrees:

$ elm-repl
Elm REPL 0.2.2.1 <https://github.com/elm-lang/elm-repl#elm-repl>
Type :help for help, :exit to exit
> link
<function> : String -> Element -> Element

Actually attempting to compile with 0.12.1.3 seems to bear out elm-repl's side of the story. String -> Element -> Element, if correct, is more sensible anyway!

dev Out of Sync with Elm dev (FFI->Ports)

A lot of web site code uses the FFI so needs to be updated to use ports. I encountered while trying to profile some compilation slowness.

It's kinda tedious though. You could probably tell the mailing list it needs doing and someone will do it to get experience with the Ports syntax.

Escape from Callback Hell broken

Piling on another distraction, come back when you've got time to kill.

The Escape from Callback Hell article interactive components do not react. The console says that dropTil is blowing the stack, which is reasonable since it's recursively peeling off a letter. I can't get the page to run locally, hence the absence of a pull request. It will probably take some finagling to get working again, but for starters,

dropTil' str = case String.indexes "[" str of                                       
    (i::_) -> String.dropLeft (i+1) str                                             
    [] -> str 

Also, the libraries link in the second-to-last paragraph 404s. And it says Elm is only in 0.5; your call if you want to try to keep that updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.