Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

start process of adding .hs to elm-lang repository

  • Loading branch information...
commit 50644bd9a6b2c3956fa71dd2eac508574fa7beb3 1 parent babd44c
@evancz evancz authored
View
5 .gitignore
@@ -1,5 +0,0 @@
-
-/Website/Docs.js
-/Website/libs.js
-/Website/Skeleton.js
-/Website/Tiles.js
View
65 Documentation.elm
@@ -1,65 +0,0 @@
-
-import Website.Skeleton (addSpaces, skeleton)
-import Website.Tiles (tile)
-import Data.List
-import Graphics.Text as Text
-
-standard = ("General Purpose",
- [ ("Data.Char", "docs/Data/Char.elm")
- , ("Data.Maybe", "docs/Data/Maybe.elm")
- , ("Data.List", "docs/Data/List.elm")
- , ("Prelude", "docs/Prelude.elm")
- ])
-
-elements = ("Graphics",
- [ ("Graphics.Element", "docs/Graphics/Element.elm")
- , ("Graphics.Color" , "docs/Graphics/Color.elm")
- , ("Graphics.Text", "docs/Graphics/Text.elm")
- ])
-
-reaction = ("Signals",
- [ ("Signal" , "docs/Signal/Signal.elm")
- , ("Signal.Mouse" , "docs/Signal/Mouse.elm")
- , ("Signal.Keyboard.Raw", "docs/Signal/KeyboardRaw.elm")
- , ("Signal.Window" , "docs/Signal/Window.elm")
- , ("Signal.Time" , "docs/Signal/Time.elm")
- , ("Signal.HTTP" , "docs/Signal/HTTP.elm")
- , ("Signal.Input" , "docs/Signal/Input.elm")
- , ("Signal.Random" , "docs/Signal/Random.elm")
- ])
-
-ffi = ("JavaScript Interface",
- [ ("Foreign.JavaScript", "docs/Foreign/JavaScript.elm")
- , ("Foreign.JavaScript.Experimental", "docs/Foreign/JavaScript/Experimental.elm")
- , ("Foreign.JavaScript.JSON", "docs/Foreign/JavaScript/JSON.elm")
- ])
-
-intro = [markdown|
-
-### Library Documentation
-
-This section provides type-signatures and explanations of Elm's current
-standard libraries.
-
-[This blog][1] is the source of some discussion and
-announcements. It also has more detailed information on the [module system][2]
-and [JavaScript integration][3].
-
-My [thesis][4] gives a more formal specification of Elm.
-
- [1]: http://www.testblogpleaseignore.com "Elm blog"
- [2]: http://www.testblogpleaseignore.com/2012/06/19/announcing-elm-0-3-modules/ "module system"
- [3]: http://www.testblogpleaseignore.com/2012/06/29/announcing-elm-0-3-5-javascript-integration-signal-filters-and-more/ "JavaScript integration"
- [4]: http://www.testblogpleaseignore.com/wp-content/uploads/2012/04/thesis.pdf "Elm Thesis"
-
-|]
-
-linkify (name, src) = toText " " ++ Text.link src (toText name)
-linkList (name, pairs) =
- flow down . map text $ bold (toText name) : map linkify pairs
-links = map linkList [ standard, elements, reaction, ffi ]
-
-categories w =
- flow down . map (width w) . intersperse (plainText " ") $ intro : links
-
-main = lift (skeleton categories) Window.width
View
26 Download.elm
@@ -1,26 +0,0 @@
-
-import Website.Skeleton
-import Signal.Window as Window
-
-info w = width w [markdown|
-
-### Installation
-
-See these [install instructions][1] to get Elm running on your machine.
-If you run into problems, you should email the [mailing list][2]
-or report an issue to Elm's [source repository][3]
-
-### Thesis on Elm
-
-My [thesis on Elm][4] is available too. It provides a more formal
-definition of Elm and a discription of Concurrent FRP, a new approach
-to efficient Functional Reactive Programming.
-
- [1]: https://github.com/evancz/Elm/blob/master/README.md "install instructions"
- [2]: https://groups.google.com/forum/?fromgroups#!forum/elm-discuss "email list"
- [3]: https://github.com/evancz/Elm "source repository"
- [4]: http://www.testblogpleaseignore.com/wp-content/uploads/2012/04/thesis.pdf "thesis on Elm"
-
-|]
-
-main = lift (skeleton info) Window.width
View
67 Elm.elm
@@ -1,67 +0,0 @@
-import Website.Skeleton
-import Website.Tiles
-
-intro = [markdown|
-
-### The Elm Programming Language
-
-The Elm programming language aims to make web development
-more pleasant. Elm is a type-safe, functional reactive language
-that compiles to HTML, CSS, and JavaScript. You can start coding
-in Elm without any install or setup with Elm's [interactive editor][1],
-so start learning Elm by [example][2]:
-
- [1]: /edit/examples/Reactive/Transforms.elm "interactive editor"
- [2]: /Examples.elm "example"
-
-|]
-
-exampleData =
- [ ("Layout" , "FlowDown2" , "Elements/")
- , ("Shapes" , "Shapes" , "Elements/")
- , ("Analog Clock" , "Clock" , "Intermediate/")
- , ("Slide Show" , "SlideShow" , "Intermediate/")
- , ("Form Validation", "Form" , "Intermediate/")
- ]
-
-examples w = let tiles = tile w $ map toTile exampleData in
- container w (heightOf tiles) middle tiles
-
-rest = [markdown|
-
-Elm's major distinguishing features are support for [reactive programming][1]
-and its focus on graphical user interfaces. Elm is also [call-by-value][2] and
-[strongly][3] / [statically][4] typed with [type inference][5], so those of you
-already familiar with languages like Haskell or ML should be quite comfortable.
-
-The language features mentioned above help catch errors in your code at
-compile time, but there are some errors that are external to your code,
-such as browser incompatabilities. By using HTML, CSS, and JavaScript as
-an assembly language, Elm can avoid some of these problems.
-
- [1]: http://en.wikipedia.org/wiki/Reactive_programming "reactive programming"
- [2]: http://en.wikipedia.org/wiki/Evaluation_strategy "call-by-value"
- [3]: http://en.wikipedia.org/wiki/Strong_typing "strongly"
- [4]: http://en.wikipedia.org/wiki/Type_system#Static_typing "statically"
- [5]: http://en.wikipedia.org/wiki/Type_inference "type inference"
-
-<br/>
-
-#### News
-
-Elm 0.4: New features for game making and layout, Markdown support,
-optimizations, and more. More information [here][6].
-
- [6]: /blog/announce/version-0.4.0.elm "announcement"
-
-#### Contact
-
-See the Elm [mailing list][7] for questions, announcements, and discussion. You can contact me directly at info (at) elm-lang (dot) org.
-
- [7]: https://groups.google.com/forum/?fromgroups#!forum/elm-discuss "mailing list"
-
-|]
-
-info w = flow down $ map (width w) [ intro, examples w, rest ]
-
-main = lift (skeleton info) Window.width
View
55 Examples.elm
@@ -1,55 +0,0 @@
-
-import Website.Skeleton
-import Website.Tiles
-
-words = [markdown|
-
-### Learn by Example
-
-Elm's interactive editor allows you to learn Elm by seeing and modifying
-actual code. There are a couple categories of examples for designed to build
-certain skills:
-
-[Basic][1] &#8212; the basic building blocks of Elm
-
-[Intermediate][2] &#8212; building components with Elm
-
-[Elm + JavaScript][3] &#8212; use existing JavaScript libraries, features, etc.
-
-[Elm + Haskell][4] &#8212; serve Elm code without leaving Haskell
-
-[This Website][5] &#8212; the Elm source code for this site
-
-[Elm for Games][6] &#8212; how to make games in Elm
-
-<br/>
-
- [1]: /examples/Basic.elm "Basic"
- [2]: /examples/Intermediate.elm "Intermediate"
- [3]: /examples/ElmJS.elm "Elm + JavaScript"
- [4]: /examples/ElmHaskell.elm "Elm + Haskell"
- [5]: /examples/ThisWebsite.elm "This Website"
- [6]: /blog/games-in-elm/part-0/Making-Pong.html "Elm for Games"
-
-### Quick Overview of Elm
-
-If you just want a brief overview, check out the following examples:
-
-|]
-
-examples =
- [ ("Layout" , "FlowDown2" , "Elements/")
- , ("Centering" , "Centering" , "Reactive/")
- , ("Shapes" , "Shapes" , "Elements/")
- , ("Abstract Data Types", "Tree", "Functional/")
- , ("Analog Clock" , "Clock" , "Intermediate/")
- , ("Light Box" , "LightBox" , "Intermediate/")
- , ("Graphs" , "Plot" , "Intermediate/")
- , ("Form Validation", "Form" , "Intermediate/")
- , ("This Page" , "Examples" , "../")
- ]
-
-content w = let tiles = tile w $ map toTile examples in
- width w words `above` container w (heightOf tiles) middle tiles
-
-main = lift (skeleton content) Window.width
View
4 README.md
@@ -1,4 +0,0 @@
-elm-lang.org
-============
-
-The .elm source files used to create [elm-lang.org](http://elm-lang.org/), the home-page of the Elm programming language.
View
257 blog/announce/version-0.4.0.elm
@@ -1,257 +0,0 @@
-
-import Foreign.JavaScript
-import Signal.Window as Win
-
-title = constant (castStringToJSString "Elm 0.4: Graphics Upgrade")
-foreign export jsevent "elm_title"
- title :: Signal JSString
-
-blog = [markdown|
-
-# Elm 0.4: Graphics Upgrade
-
-This release makes [Elm](/) better for:
-
-* **Making games.** Elements, sprites, and textures can now be used in a `collage`
- This includes text, gifs, videos, and any other complex `Element`, making Elm much
- more flexible for game creation. Check out examples of the new features
- ([Elements][a], [sprites][b], [textures][c]) and learn how to make games with
- the [Pong walkthrough][pong].
-
-* **Creating text.** Elm now has native [Markdown][1] support ([example][2]).
- You can also set typefaces (a.k.a. "fonts") programatically ([example][typeface]).
-
-* **Graphics in general.** Screen updates are now much more efficient, reducing
- memory usage, CPU usage, and screen flickering. You can also get some information
- about elements with `widthOf`, `heightOf`, and `sizeOf`.
-
-* **Everything.** The compiler now performs slightly more aggressive optimizations,
- and it produces pattern matching code that is much faster. And minification of generated
- JavaScript is now possible with the `--minify` compiler flag.
-
-I am really excited about these new features, and I think they substantially
-increase the practicality and pleasantness of Elm. And with the `collage` additions,
-I think Elm is currently the best language for creating purely functional
-online games.
-
-To install see the [instructions](https://github.com/evancz/Elm/blob/master/README.md)
-on [github](https://github.com/evancz/Elm), and to upgrade use the command:
-
- cabal update ; cabal install elm
-
-The rest of this post is devoted to explaining the new features and providing
-examples of their usage. These improvements also come with some minor breaking
-changes, which are detailed below with upgrade advice.
-
-I hope you enjoy Elm 0.4!
-
- [pong]: /blog/games-in-elm/part-0/Making-Pong.html "Pong"
- [a]: /edit/examples/Elements/ToForm.elm "toForm"
- [b]: /edit/examples/Elements/Sprite.elm "sprites"
- [c]: /edit/examples/Elements/Texture.elm "texture"
-
-<br/>
-
-## Markdown Support
-
-Creating text in a language designed for GUIs *should* be really easy. Well
-now it is! [Markdown][1] can now be embedded directly in Elm!
-Markdown lets you write fairly complicated formatted text
-"using an easy-to-read, easy-to-write plain text format".
-
-The syntax is as follows:
-
- [markdown| ... |\] :: Element
-
-Where `...` is some Markdown (and can span multiple lines). For example:
-
- main = [markdown|
-
- The Title
- =========
-
- This is a paragraph.
- This sentence is part of the same paragraph.
-
- |\]
-
-See [this example][2] if you want to play around with this feature, and be sure
-to check out [this site][1] to learn the full capabilities of Markdown.
-
-This blog post ([source][blog]) is actually written using this feature!
-I had no idea such a simple addition could have such a positive impact!
-
- [1]: http://daringfireball.net/projects/markdown/dingus "Markdown"
- [2]: /edit/examples/Elements/Markdown.elm "Elm+Markdown example"
- [blog]: /edit/blog/announce/version-0.4.0.elm "Edit Announcement"
-
-<br/>
-
-## Games: Elements, Sprites, and Textures
-
-The `collage` interface just became *way* more flexible. Collages can now
-include pretty much anything. More specifically:
-
-* Display *any* `Element` with:
- `toForm :: (Int,Int) -> Element -> Form`<br/>
- This allows you to use text, gifs, videos, and other complex components
- just like any other `Form`.
-
-* Display sprites with:
- `sprite :: String -> Int -> Int -> (Int,Int) -> Form`
-
-* Fill shapes with arbitrary textures with:
- `texture :: String -> Shape -> Form`
-
-All of these new forms can be moved, scaled, and rotated.
-
-I think these additions, especially `toForm`, make Elm the nicest and easiest
-way to make games in a functional language. Of course, I am totally biased, so
-you can decide for yourself!
-
-These additions required a small change to the API for transforms. The new
-functions have the following types:
-
- move :: Int -> Int -> Form -> Form
- rotate :: Float -> Form -> Form
- scale :: Float -> Form -> Form
-
-The only difference is that a transform now acts upon a `Form` instead of
-directly upon a form-precursor (a `Shape` or `Line`). Before, form-precursors
-could *only* appear in a collage. Now that the form-precursors also include
-Elements, this approach is not possible. What would it mean to rotate an Element?!
-
-<br/>
-
-## Graphics in General
-
-Along with the more obvious API changes, Elm has also undergone some major internal
-rewrites. The part of the runtime-system (RTS) responsible for screen updates has been
-completely rewritten to make things more efficient.
-
-The RTS now manipulates the DOM way less frequently, so creation of new DOM nodes has
-decreased dramatically. This means fewer cycles are spent messing with the DOM, less
-memory is wasted on unused DOM nodes, and the JavaScript garbage-collector
-spends less time cleaning up the mess afterwards.
-
-This is great for Elm in general, and it is particularly important for game making.
-
-
-<br/>
-
-## New Functions
-
-#### Typeface
-
-Set the typeface (often incorrectly called the "font") used to display text.
-The string argument contains the names of the typefaces you want to use.
-
- typeface :: String -> Text -> Text
-
-See the [`typeface` example][typeface] for details.
-
- [typeface]: /edit/examples/Elements/Typeface.elm "typeface example"
-
-#### Dimensions
-
-You can look up the dimensions of an `Element` with:
-
- widthOf :: Element -> Int
- heightOf :: Element -> Int
- sizeOf :: Element -> (Int,Int)
-
-This should make it easier to create higher-order elements (functions that take
-take elements as arguments and produce a more complicated layout).
-
-
-<br/>
-
-## Optimizations, Pattern Matching, Minification
-
-The compiler now performs beta-reduction when it reduces the size of the output.
-
-Pattern matching is implemented much more efficiently (as described
-[here](http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/start.htm)).
-
-You can also reduce the size of the compiler output by using the `--minify` flag.
-
-<br/>
-
-## Breaking Changes
-
-The following changes were made after much deliberation, but I think they are best for
-Elm. If they cause you trouble, please email the [list][elm-discuss] and tell
-me what is up. I will do everything I can to make the transition to 0.4 as smooth
-as possible.
-
- [elm-discuss]: https://groups.google.com/forum/?fromgroups#!forum/elm-discuss "elm-discuss"
-
-#### Dimensions for Images and Videos
-
-This one is sad, but `image` and `video` both require a width and a
-height. The new API is:
-
- image, video :: Int -> Int -> String -> Element
-
-This unfortunate requirement has a very good rational though.
-
-This version of Elm allows some inspection of Elements with `widthOf`,
-`heightOf`, and `sizeOf`. A very useful feature to have! To implement
-these functions, the size of every Element must be known at runtime.
-"No problem," you might think, "images and videos have a default size!"
-Yes, but image and video content is loaded asynchronously. If we want to
-know the default size of an image, we have to wait until it loads. This
-would mean that an Elm program would block until every single image is
-loaded. But what if one of the images does not load? The entire page
-does not load!
-
-It is actually still possible to load an image without specifying dimensions,
-but the API is a little different:
-
- images :: Signal String -> Signal Element
-
-The old `image src` is almost the same as `images (constant src)`, but
-instead of yeilding an `Element`, the new version produces `Signal Element`.
-This is actually the correct API because it captures the fact that
-the image loads asynchronously.
-
-#### Containers and Spacers
-
-Two existing functions (`box` and `rectangle`) have been renamed and reworked
-(now `container` and `spacer`).
-
- container :: Int -> Int -> Position -> Element -> Element
- spacer :: Int -> Int -> Element
-
-For more info on the new functions see the [`container` example][container] and the
-[`spacer` example][spacer].
-
- [container]: /edit/examples/Elements/Position.elm "container example"
- [spacer]: /edit/examples/Elements/Spacer.elm "spacer example"
-
-If you have code that uses the old versions, you can just add these two
-definitions to your code:
-
- box n e =
- let pos = head . drop ((n-1) `mod` 9) $
- [ topLeft, midTop, topRight
- , midLeft, middle, midRight
- , bottomLeft, midBottom, bottomRight ]
- in container (widthOf e) (heightOf e) pos e
-
- rectangle = spacer
-
-I would really recommend updating the code (it was a pretty easy change in
-my experience), but it is your call!
-
-|]
-
-page = flow down
- [ container 600 40 bottomRight (text . Text.link "/" $ toText "Home")
- , width 600 blog
- , container 600 60 middle . text . Text.color (rgb 216 221 225) $
- toText "&copy; 2011-2012 Evan Czaplicki"
- ]
-
-main = lift (\w -> container w (heightOf page) midTop page) Win.width
-
View
15 docs/Data/Char.elm
@@ -1,15 +0,0 @@
-
-import Website.Docs (createDocs)
-
-basics =
- [ ("toUpper", "Char -> Char", "Convert to upper case.")
- , ("toLower", "Char -> Char", "Convert to lower case.")
- , ("toLocaleUpper", "Char -> Char", "Convert to upper case, according to any locale-specific case mappings.")
- , ("toLocaleLower", "Char -> Char", "Convert to lower case, according to any locale-specific case mappings.")
- , ("toCode" , "Char -> Int", "Convert to unicode.")
- , ("fromCode", "Int -> Char", "Convert from unicode.")
- ]
-
-categories = [ ("Basic Utilities", basics) ]
-
-main = createDocs "Data.Char" categories
View
59 docs/Data/List.elm
@@ -1,59 +0,0 @@
-
-import Website.Docs (createDocs)
-
-basics =
- [ ("(:)", "a -> [a] -> [a]", "Add an element to the front of a list (a : [b,c] = [a,b,c]).")
- , ("(++)", "[a] -> [a] -> [a]", "Appends two lists.")
- , ("head", "[a] -> a", "Extract the first element of a list. List must be non-empty.")
- , ("tail", "[a] -> [a]", "Extract the elements after the head of the list. List must be non-empty.")
- , ("last", "[a] -> a", "Extract the last element of a list. List must be non-empty.")
- , ("length", "[a] -> Int", "Determine the length of a list.")
- ]
-
-transforms =
- [ ("map", "(a -> b) -> [a] -> [b]", "Apply a function to every element of a list.")
- , ("reverse", "[a] -> [a]", "Reverse a list.")
- , ("intersperse", "a -> [a] -> [a]", "Places the given value between all members of the given list.")
- , ("intercalate", "[a] -> [[a]] -> [a]", "Places the given value between all of the lists in the second argument and concatenates the result. Note: intercalate xs xss = concat (intersperse xs xss)")
- ]
-
-folds =
- [ ("foldr", "(a -> b -> b) -> b -> [a] -> b", "Reduce a list from the right.")
- , ("foldl", "(a -> b -> b) -> b -> [a] -> b", "Reduce a list from the left.")
- , ("foldr1", "(a -> a -> a) -> [a] -> a", "Reduce a list from the right without a base case. List must be non-empty.")
- , ("foldl1", "(a -> a -> a) -> [a] -> a", "Reduce a list from the left without a base case. List must be non-empty.")
- , ("scanl", "(a -> b -> b) -> b -> [a] -> [b]", "Reduce a list from the left, building up all of the intermediate results into a list.")
- , ("scanl1", "(a -> a -> a) -> [a] -> [a]", "Same as scanl but it doesn't require a base case. List must be non-empty.")
- ]
-
-special =
- [ ("concat", "[[a]] -> [a]", "Flatten a list of lists.")
- , ("concatMap", "(a -> [b]) -> [a] -> [b]", "Map a given function onto a list and flatten the resulting lists. (concatMap f xs == concat (map f xs))")
- , ("and", "[Bool] -> Bool", "Check to see if all elements are True.")
- , ("or", "[Bool] -> Bool", "Check to see if any elements are True.")
- , ("forall", "(a -> Bool) -> [a] -> Bool", "Check to see if all elements satisfy the predicate.")
- , ("exists", "(a -> Bool) -> [a] -> Bool", "Check to see if any elements satisfy the predicate.")
- , ("sum", "[Int] -> Int", "Get the sum of the list elements.")
- , ("product", "[Int] -> Int", "Get the product of the list elements.")
- , ("maximum", "[Int] -> Int", "Find the highest number in a non-empty list.")
- , ("minimum", "[Int] -> Int", "Find the lowest number in a non-empty list.")
- ]
-
-other =
- [ ("filter", "(a -> Bool) -> [a] -> [a]", "Filter out elements which do not satisfy the predicate.")
- , ("sort", "[Number] -> [Number]", "Sorts a list of numbers.")
- , ("partition", "(a -> Bool) -> [a] -> ([a],[a])", "Split a list based on the predicate.")
- , ("zip", "[a] -> [b] -> [(a,b)]", "Combine two lists, combining them into tuples pairwise. If one input list has extra elements (it is longer), those elements are dropped.")
- , ("zipWith", "(a -> b -> c) -> [a] -> [b] -> [c]", "Combine two lists, combining them with the given function. If one input list has extra elements (it is longer), those elements are dropped.")
- , ("take", "Int -> [a] -> [a]", "Take the first n members of a list. Thus, (take 2 [1,2,3,4]) ==> [1,2]")
- , ("drop", "Int -> [a] -> [a]", "Drop the first n members of a list. Thus, (drop 2 [1,2,3,4]) ==> [3,4]")
- ]
-
-categories =
- [ ("Basic Utilities", basics)
- , ("List Transformations", transforms)
- , ("Folds (Reducing Lists)", folds)
- , ("Special Folds", special)
- , ("Other Useful Functions", other) ]
-
-main = createDocs "Data.List" categories
View
23 docs/Data/Maybe.elm
@@ -1,23 +0,0 @@
-
-import Website.Docs (createDocs)
-
-def =
- [ ("data Maybe a = Just a | Nothing", "", "The Maybe datatype. Useful when a computation may or may not result in a value (e.g. logarithm is defined only for positive numbers).")
- ]
-
-basics =
- [ ("maybe", "b -> (a -> b) -> Maybe a -> b", "Apply a function to the contents of a Maybe. Return default when given Nothing.")
- , ("isJust", "Maybe a -> Bool", "Check if constructed with Just.")
- , ("isNothing", "Maybe a -> Bool", "Check if constructed with Nothing.")
- , ("fromMaybe", "a -> Maybe a -> a", "Extract the value of from a Maybe. Returns default when given Nothing.")
- ]
-
-lists =
- [ ("consMaybe", "Maybe a -> [a] -> [a]", "If Just, adds the value to the front of the list. If Nothing, list is unchanged.")
- , ("catMaybes", "[Maybe a] -> [a]", "Filters out Nothings and extracts the remaining values.")
- , ("mapMaybe", "(a -> Maybe b) -> [a] -> [b]", "Maps function onto a list, discarding all Nothing results from the resulting list.")
- ]
-
-categories = [ ("Definition", def), ("Basic Utilities", basics), ("Maybe with Lists", lists) ]
-
-main = createDocs "Data.Maybe" categories
View
33 docs/Foreign/JavaScript.elm
@@ -1,33 +0,0 @@
-
-import Website.Docs (createDocs)
-
-casts =
- [ ("castJSBoolToBool" , "JSBool -> Bool", "Conversion from JavaScript boolean values to Elm boolean values.")
- , ("castBoolToJSBool" , "Bool -> JSBool", "Conversion from Elm boolean values to JavaScript boolean values.")
- , ("castJSNumberToInt" , "JSNumber -> Int", "")
- , ("castIntToJSNumber" , "Int -> JSNumber", "")
- , ("castJSNumberToFloat" , "JSNumber -> Float", "")
- , ("castFloatToJSNumber" , "Float -> JSNumber", "")
- , ("castJSStringToString" , "JSString -> String", "")
- , ("castStringToJSString" , "String -> JSString", "")
- ]
-
-polyCasts =
- [ ("castListToJSArray" , "[a] -> JSArray a", "Produces a uniform JavaScript array with all members of the same type.")
- , ("castJSArrayToList" , "JSArray a -> [a]", "Requires that the input array be uniform (all members have the same type)")
- , ("castTupleToJSTuple2" , "(a,b) -> JSTuple2 a b", "A JSTupleN is an array of size N with nonuniform types. Each member can have a different type.")
- , ("castJSTupleToTuple2" , "JSTuple2 a b -> (a,b)", "")
- , ("castTupleToJSTuple3" , "(a,b,c) -> JSTuple3 a b c", "")
- , ("castJSTupleToTuple3" , "JSTuple3 a b c > (a,b,c)", "")
- , ("castTupleToJSTuple4" , "(a,b,c,d) -> JSTuple4 a b c d", "")
- , ("castJSTupleToTuple4" , "JSTuple4 a b c d -> (a,b,c,d)", "")
- , ("castTupleToJSTuple5" , "(a,b,c,d,e) -> JSTuple5 a b c d e", "")
- , ("castJSTupleToTuple5" , "JSTuple5 a b c d e -> (a,b,c,d,e)", "")
- ]
-
-categories =
- [ ("Basic Conversions", casts)
- , ("Conversion between Data Structures", polyCasts)
- ]
-
-main = createDocs "Foreign.JavaScript" categories
View
11 docs/Foreign/JavaScript/Experimental.elm
@@ -1,11 +0,0 @@
-
-import Website.Docs (createDocs)
-
-casts =
- [ ("castJSElementToElement" , "Int -> Int -> JSElement -> Element", "All Elm Elements must have a concrete size, so the desired width and height of the JSElement must be provided.")
- , ("castElementToJSElement" , "Element -> JSElement", "This produces DOM nodes. Do not depend on the internal structure of the resulting node. It can and will change. I repeat, DO NOT depend on the internal structure of the resulting node! When your code breaks because you have ignored this warning, do not be surprised!")
- ]
-
-categories = [ ("Experimental Conversions", casts) ]
-
-main = createDocs "Foreign.JavaScript.Experimental" categories
View
48 docs/Foreign/JavaScript/JSON.elm
@@ -1,48 +0,0 @@
-
-import Website.Docs (createDocs)
-
-objects =
- [ ("empty", "JsonObject a", "Create an empty JSON mapping.")
- , ("singleton", "String -> a -> JsonObject a", "Create a JSON mapping that contains only a single key-value pair.")
- , ("insert", "String -> a -> JsonObject a -> JsonObject a", "Add a key value pair to a JSON object.")
- , ("lookup", "String -> JsonObject a -> Maybe a", "Lookup a value in a JsonObject. If the key is not found, this returns Nothing.")
- , ("findWithDefault", "a -> String -> JsonObject a -> a", "Find a value in a JsonObject. If the key is not found, this returns the given default value.")
- , ("remove", "String -> JsonObject a -> JsonObject a", "Remove a key-value pair from a JsonObject.")
- ]
-
-lists =
- [ ("toList", "JsonObject a -> [(String,a)]", "Convert a JsonObject into an association list of key-value pairs.")
- , ("fromList", "[(String,a)] -> JsonObject a", "Convert an association list into a JsonObject.")
- ]
-
-values =
- [ ("data JsonValue = JsonString String | JsonNumber Float | JsonBool Bool | JsonNull | JsonArray [JsonValue] | JsonObject (JsonObject JsonValue)", ""
- , "This datatype can represent all valid values that can be held in a JSON object. In Elm, a proper JSON object is represented as a (JsonObject JsonValue) which is a mapping from strings to JsonValues.")
- ]
-
-strings =
- [ ("toString", "JsonObject JsonValue -> String", "Convert a proper JSON object (i.e. JsonObject JsonValue) into a string.")
- , ("fromString", "String -> JsonObject JsonValue", "Parse a string representation of a proper JSON object into its Elm's representation.")
- ]
-
-jsStrings =
- [ ("toJSString", "JsonObject JsonValue -> JSString", "Convert a proper JSON object (i.e. JsonObject JsonValue) into a JavaScript string. Note that the type JSString seen here is not the same as the type constructor JsonString used elsewhere in this module.")
- , ("fromJSString", "JSString -> JsonObject JsonValue", "Parse a JavaScript string representation of a proper JSON object into its Elm's representation.")
- ]
-
-prettyStrings =
- [ ("toPrettyString", "String -> JsonObject JsonValue -> String", "Convert a proper JSON object (i.e. JsonObject JsonValue) into a prettified string. The first argument is a separator token (e.g. \" \", \"\\n\", etc.) that will be used for indentation in the prettified string version of the JSON object.")
- , ("toPrettyJSString", "String -> JsonObject JsonValue -> JSString", "Same as toPrettyString except it produces a JavaScript string instead of an Elm string.")
- ]
-
-
-categories =
- [ ("Using JSON Objects", objects)
- , ("List Conversions", lists)
- , ("Constructors for JsonValues", values)
- , ("String Conversions", strings)
- , ("Prettified Strings", prettyStrings)
- , ("JavaScript String Conversions", jsStrings)
- ]
-
-main = createDocs "Foreign.JavaScript.JSON" categories
View
14 docs/Graphics/Color.elm
@@ -1,14 +0,0 @@
-
-import Website.Docs (createDocs)
-
-creation =
- [ ("rgb", "Int -> Int -> Int -> Color", "Create rgb colors from numbers between 0 and 255 inclusive.")
- , ("rgba", "Int -> Int -> Int -> Float -> Color", "Create colors with an alpha component for transparency. The color is specified with numbers between 0 and 255 inclusive, whereas the alpha component is specified with numbers between 0 and 1.")
- , ("red, green, blue, cyan, yellow, magenta, black, white, grey, gray", "Color", "Built-in colors.")
- ]
-
-categories =
- [ ("Creating Colors", creation)
- ]
-
-main = createDocs "Color" categories
View
95 docs/Graphics/Element.elm
@@ -1,95 +0,0 @@
-
-import Website.Docs
-
-textContent =
- [ ("plainText", "String -> Element", "Display unstyled strings.")
- , ("text", "Text -> Element", "Display styled text.")
- , ("centeredText", "Text -> Element", "Display centered, styled text.")
- , ("rightedText", "Text -> Element", "Display right justified, styled text.")
- , ("justifiedText", "Text -> Element", "Display justified, styled text.")
- ]
-
-visualContent =
- [ ("image", "Int -> Int -> String -> Element", "Display images based on dimensions and resource location.")
- , ("fittedImage", "Int -> Int -> String -> Element", "Display images fitted to a given width and height. The image will be scaled such that it fills the desired area without stretching the image. If the aspect ratio of the given image does not match, it will be cropped and centered.")
- , ("images", "Signal String -> Signal Element", "Asynchronously loads images given their resource locaition. The images dimensions are the default size of the image.")
- , ("video", "Int -> Int -> String -> Element", "Display videos based on dimensions and resource location.")
- , ("collage", "Int -> Int -> [Form] -> Element", "Renders the scene specified by the given width, height, and list of primitive graphical forms. These forms can be anything including lines, shapes, images, and Elements. Every Form can be moved, scaled, and rotated. More on forms later.")
- ]
-
-combiningContent =
- [ ("flow", "Direction -> [Element] -> Element", "Display a list of Elements, flowing in the given direction.")
- , ("up, down, left, right, inward, outward", "Direction", "The six possible directions for content flow. Used only with the flow function.")
- , ("above", "Element -> Element -> Element", "(a `above` b) is the same as (flow down [a,b]), placing element a above element b")
- , ("below", "Element -> Element -> Element", "(a `below` b) is the same as (flow down [b,a]), placing element a below element b")
- , ("beside", "Element -> Element -> Element", "(a `beside` b) is the same as (flow right [a,b]), placing element a to the left of element b.")
- , ("layers", "[Element] -> Element", "Stack elements on top of each other.")
- ]
-
-stylingContent =
- [ ("width", "Int -> Element -> Element", "Set the width of an element in pixels.")
- , ("height", "Int -> Element -> Element", "Set the width of an element in pixels.")
- , ("size", "Int -> Int -> Element -> Element", "Set the width and height of an element in pixels.")
- , ("opacity", "Number -> Element -> Element", "Set the opacity of an element. Requires a number between 0 and 1.")
- , ("color", "Color -> Element -> Element", "Set the background color of an element.")
- , ("link", "String -> Element -> Element", "Turn any element into a link.")
- ]
-
-inspectingContent =
- [ ("widthOf", "Element -> Int", "Get the width of an element in pixels.")
- , ("heightOf", "Element -> Int", "Get the width of an element in pixels.")
- , ("sizeOf", "Element -> (Int,Int)", "Get the width and height of an element in pixels.")
- ]
-
-positioningContent =
- [ ("spacer", "Int -> Int -> Element", "Create an empty element. Good for adding spaces.")
- , ("container", "Int -> Int -> Position -> Element -> Element", "Put an element in a container.")
- , ("topLeft, midLeft, bottomLeft, midTop, middle, midBottom, topRight, midRight, bottomRight", "Position", "Basic positions for an element in a container.")
- , ("topLeftAt, bottomLeftAt, middleAt, topRightAt, bottomRightAt", "Location -> Location -> Position", "Allows more flexible positioning of elements.")
- , ("absolute", "Int -> Location", "An absolute location in pixels.")
- , ("relative", "Float -> Location", "A relative location, given as a percentage.")
- ]
-
-forms =
- [ ("toForm", "(Number,Number) -> Element -> Form", "Turn any Element into a Form")
- , ("sprite", "String -> Number -> Number -> (Number,Number) -> Form", "Create a sprite.")
- , ("move", "Number -> Number -> Form -> Form", "Translate a form by a given x and y offset.")
- , ("rotate", "Number -> Number -> Form -> Form", "Rotate a form by a given fraction of a full turn (not degrees or radians). For instance, (rotate 0.5) will rotate a form by a half turn.")
- , ("scale", "Number -> Form -> Form", "Scale a form by a given scale factor.")
- ]
-
-
-shapes =
- [ ("rect", "Number -> Number -> (Number,Number) -> Shape", "Create a rectangle with a given width, height, and center position.")
- , ("oval", "Number -> Number -> (Number,Number) -> Shape", "Create an oval with a given width, height, and center position.")
- , ("circle", "Number -> (Number,Number) -> Shape", "Create a circle with a given radius and center position.")
- , ("ngon", "Number -> Number -> (Number,Number) -> Shape", "Create regular polygons with n sides. This function takes the number of sides, the radius (distance from the center to a vertex), and a center.")
- , ("polygon", "[(Number,Number)] -> (Number,Number) -> Shape", "Create an arbitrary polygon from an list of vertexes and a center point. The vertexes should be listed relative to the origin (0,0). They are then translated to the given center.")
- , ("filled", "Color -> Shape -> Form", "Fill a shape with a given color.")
- , ("outlined", "Color -> Shape -> Form", "Outline a shape with a given color.")
- , ("customOutline", "[Number] -> Color -> Shape -> Form", "Outline a shape with a given pattern and color. The pattern is specified by the list of numbers. For instance, the pattern [8,4] creates long dashes (8 pixels long) followed by short spaces (4 pixels long).")
- , ("textured", "String -> Shape -> Form", "Fill a shape with a given texture.")
- ]
-
-lines =
- [ ("line", "[(Number,Number)] -> Line", "Create a line from an list of vertexes.")
- , ("segment", "(Number,Number) -> (Number,Number) -> Line", "Create a line segment with a start and end point.")
- , ("solid", "Color -> Line -> Form", "Create a solid line with a given color.")
- , ("dashed", "Color -> Line -> Form", "Create a dashed line with a given color.")
- , ("dotted", "Color -> Line -> Form", "Create a dotted line with a given color.")
- , ("customLine", "[Number] -> Color -> Line -> Form", "Create a custom line with a given pattern and color. The pattern is specified by the list of numbers. For instance, the pattern [8,4] creates long dashes (8 pixels long) followed by short spaces (4 pixels long).")
- ]
-
-categories =
- [ ("Visual Content", visualContent)
- , ("Text Content", textContent)
- , ("Combining Content", combiningContent)
- , ("Styling Content", stylingContent)
- , ("Inspecting Content", inspectingContent)
- , ("Positioning Content", positioningContent)
- , ("Collage", forms)
- , ("Collage: Shapes", shapes)
- , ("Collage: Lines", lines)
- ]
-
-main = createDocs "Graphics.Element" categories
View
32 docs/Graphics/Text.elm
@@ -1,32 +0,0 @@
-
-import Website.Docs (createDocs)
-
-
-creation =
- [ ("toText", "String -> Text", "Convert a string into text which can be styled and displayed.")
- , ("link", "String -> Text -> Text", "Create a link.")
- ]
-
-textSize =
- [ ("header", "Text -> Text", "Makes text big and noticable.")
- , ("height", "Number -> Text -> Text", "Sets the height of text in \"ems\". 1em is the normal height of text. 2ems is twice that height.")
- ]
-
-styles =
- [ ("italic", "Text -> Text", "Italicize a string.")
- , ("bold", "Text -> Text", "Make a string bold.")
- , ("underline", "Text -> Text", "Underline a string.")
- , ("color", "Color -> Text -> Text", "Set the color of a string.")
- , ("monospace", "Text -> Text", "Switch to a monospace typeface. Good for code snippets.")
- , ("typeface", "String -> Text -> Text", "Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces (e.g. \"helvetica, arial, sans-serif\"). Works the same as the CSS font-family property.")
- , ("overline", "Text -> Text", "Draw a line above a string.")
- , ("strikeThrough", "Text -> Text", "Draw a line through a string.")
- ]
-
-categories =
- [ ("Creating Text", creation)
- , ("Styling Text", styles)
- , ("Ajust Text Size", textSize)
- ]
-
-main = createDocs "Graphics.Text" categories
View
26 docs/Signal/HTTP.elm
@@ -1,26 +0,0 @@
-
-import Website.Docs
-
-datatypes =
- [ ("data Response a = Waiting | Success a | Failure Int String", "", "The datatype for responses. Success contains only the returned message. Failures contain both an error code and an error message.")
- ]
-
-singles =
- [ ("get", "String -> Signal (Response String)", "Performs an HTTP get request with the given address. Produces a signal that carries the response.")
- , ("post", "String -> Signal (Response String)", "Performs an HTTP post request with the given address. Produces a signal that carries the response.")
- ]
-
-multis =
- [ ("gets", "Signal (Maybe String) -> Signal (Maybe (Response String))",
- "Produces a signal that carries 'Just' the response when given 'Just' a URL. Uses get requests.")
- , ("posts", "Signal (Maybe String) -> Signal (Maybe (Response String))",
- "Produces a signal that carries 'Just' the response when given 'Just' a URL. Uses post requests.")
- ]
-
-categories =
- [ ("Responses", datatypes)
- , ("Single Requests", singles)
- , ("Multiple Requests", multis)
- ]
-
-main = createDocs "Signal.HTTP" categories
View
27 docs/Signal/Input.elm
@@ -1,27 +0,0 @@
-
-import Website.Docs
-
-txt =
- [ ("textField", "String -> (Element, Signal String)", "Create a standard text field and a signal that represents the current user input in that field. The input string is \"ghost-text\" that appears when the user has yet to input any text.")
- , ("password", "String -> (Element, Signal String)", "Create a standard password field and a signal representing its current content. The input string is \"ghost-text\" that appears when the user has yet to input any text.")
- , ("textArea", "Int -> Int -> (Element, Signal String)", "Create a larger area for text and a signal representing its content. The input integers are the width and height of the text area in characters. This is useful for longer text input.")
- ]
-
-boxes =
- [ ("checkBox", "Bool -> (Element, Signal Bool)", "Create a check box and a signal representing whether the box is checked. The input specifies the default value for the box.") ]
-
-drops =
- [ ("stringDropDown", "[String] -> (Element, Signal String)", "Input a list of options to create a drop down menu and a signal of the currently selected option.")
- , ("dropDown", "[(String,a)] -> (Element, Signal a)", "Input a list of options. Each option is a pair containing the text to be displayed and a corresponding value of any type. This creates a drop down menu and a signal of the value corresponding to the currently selected option.")
- ]
-
-buttons =
- [ ("button", "String -> (Element, Signal Bool)", "Create a button and a signal representing whether the button has been pressed. The input specifies the string displayed on the button.") ]
-
-categories = [ ("Text Input", txt)
- , ("Buttons", buttons)
- , ("Check Boxes", boxes)
- , ("Drop Downs", drops)
- ]
-
-main = createDocs "Signal.Input" categories
View
11 docs/Signal/KeyboardRaw.elm
@@ -1,11 +0,0 @@
-
-import Website.Docs (createDocs)
-
-sigs =
- [ ("keysDown", "Signal [Int]", "The key codes of they keboard keys that are currently pressed, in the order that they were pressed. The key codes are equal to the JavaScript keyCode for each key.")
- , ("charPressed", "Signal (Maybe Int)", "The char code of the currently pressed key. When a key is pressed, its char code appears in this signal very briefly. The chare codes are given by the JavaScript expression (e.charCode || e.keyCode)")
- ]
-
-categories = [ ("Keyboard Status", sigs) ]
-
-main = createDocs "Signal.Keyboard.Raw" categories
View
20 docs/Signal/Mouse.elm
@@ -1,20 +0,0 @@
-
-import Website.Docs (createDocs)
-
-
-position =
- [ ("position", "Signal (Int,Int)", "The current mouse position.")
- , ("x", "Signal Int", "The current x-coordinate of the mouse.")
- , ("y", "Signal Int", "The current y-coordinate of the mouse.")
- ]
-
-mbuttons =
- [ ("isDown", "Signal Bool", "The current state of the left mouse-button. True when the button is down, and false otherwise.")
- , ("isClicked", "Signal Bool", "True immediately after the left mouse-button has been clicked, and false otherwise.")
- , ("clicks", "Signal ()", "Always equal to unit. Event triggers on every mouse click.")
- , ("isClickedOn", "Element -> (Element, Signal Bool)", "Determine whether an element has been clicked. The resulting pair is a signal of booleans that is true when its paired element has been clicked. The signal is True immediately after the left mouse-button has been clicked, and false otherwise.")
- ]
-
-categories = [ ("Position", position), ("Button Status", mbuttons) ]
-
-main = createDocs "Signal.Mouse" categories
View
11 docs/Signal/Random.elm
@@ -1,11 +0,0 @@
-
-import Website.Docs (createDocs)
-
-ranges =
- [ ("inRange", "Int -> Int -> Signal Int", "Given a range from low to high, this produces a random number between 'low' and 'high' inclusive. The value in the signal does not change after the page has loaded.")
- , ("randomize", "Int -> Int -> Signal a -> Signal Int", "Given a range from low to high and a signal of values, this produces a new signal that changes whenever the input signal changes. The new values are random number between 'low' and 'high' inclusive.")
- ]
-
-categories = [ ("In a Range", ranges) ]
-
-main = createDocs "Signal.Random" categories
View
34 docs/Signal/Signal.elm
@@ -1,34 +0,0 @@
-
-import Website.Docs (createDocs)
-
-
-lifts =
- [ ("constant", "a -> Signal a", "Create a constant signal that never changes.")
- , ("lift", "(a -> b) -> Signal a -> Signal b", "Transform a signal with a given function.")
- , ("lift2", "(a -> b -> c) -> Signal a -> Signal b -> Signal c", "Combine two signals with a given function.")
- , ("lift3", "(a -> b -> c -> d) -> Signal a -> Signal b -> Signal c -> Signal d", "Combine three signals with a given function.")
- , ("lift4", "(a -> b -> c -> d -> e) -> Signal a -> Signal b -> Signal c -> Signal d -> Signal e", "Combine four signals with a given function.")
- ]
-
-folds =
- [ ("foldp", "(a -> b -> b) -> b -> Signal a -> Signal b", "Create a past-dependent signal. Each value given on the input signal will be accumulated, producing a new output value. For instance, (foldp (\t count -> count + 1) 0 (Time.every 3) counts up every time the timer ticks.")
- , ("count", "Signal a -> Signal Int", "Count the number of events that have occured.")
- ]
-
-filters =
- [ ("keepIf", "(a -> Bool) -> a -> Signal a -> Signal a", "Keep only events that satisfy the given predicate. Elm does not allow undefined signals, so a base case must be provided in case the predicate is never satisfied.")
- , ("dropIf", "(a -> Bool) -> a -> Signal a -> Signal a", "Drop events that satisfy the given predicate. Elm does not allow undefined signals, so a base case must be provided in case the predicate is never satisfied.")
- , ("keepWhen", "Signal Bool -> a -> Signal a -> Signal a", "Keep events only when the first signal is true. When the first signal becomes true, the most recent value of the second signal will be propagated. Until the first signal becomes false again, all events will be propagated. Elm does not allow undefined signals, so a base case must be provided in case the first signal is never true.")
- , ("dropWhen", "Signal Bool -> a -> Signal a -> Signal a", "Drop events when the first signal is true. When the first signal becomes false, the most recent value of the second signal will be propagated. Until the first signal becomes true again, all events will be propagated. Elm does not allow undefined signals, so a base case must be provided in case the first signal is always true.")
- , ("dropRepeats", "Signal a -> Signal a", "Drop sequential repeated values. For example, if a signal produces the sequence [1,1,2,2,1], it becomes [1,2,1] by dropping the values that are the same as the previous value.")
- , ("sampleOn", "Signal a -> Signal b -> Signal b"
- , "Sample from the second input every time an event occurs on the first input. For example, (sampleOn clicks (every 1)) will give the approximate time of the latest click.")
- ]
-
-categories =
- [ ("Lifts (Transforming and Combining Signals)", lifts)
- , ("Folds (Past-Dependent Transformations)", folds)
- , ("Filters", filters)
- ]
-
-main = createDocs "Signal" categories
View
16 docs/Signal/Time.elm
@@ -1,16 +0,0 @@
-
-import Website.Docs (createDocs)
-
-ticker =
- [ ("every", "Time -> Signal Time", "Takes a time interval t. The resulting signal shows the time since the program began, updated every t seconds.")
- ]
-
-other =
- [ ("before", "Time -> Signal Bool", "Takes a time interval t. The resulting signal is true until t seconds have passed, then false.")
- , ("after", "Time -> Signal Bool", "Takes a time interval t. The resulting signal is false until t seconds have passed, then true.")
- ]
-
-
-categories = [ ("Tickers", ticker), ("Simple Timers", other) ]
-
-main = createDocs "Signal.Time" categories
View
12 docs/Signal/Window.elm
@@ -1,12 +0,0 @@
-
-import Website.Docs (createDocs)
-
-dims =
- [ ("dimensions", "Signal (Int,Int)", "The current dimensions of the window (i.e. the area viewable to the user, not including scroll bars).")
- , ("width", "Signal Int", "The current width of the window.")
- , ("height", "Signal Int", "The current height of the window.")
- ]
-
-categories = [ ("Dimensions", dims) ]
-
-main = createDocs "Signal.Window" categories
Please sign in to comment.
Something went wrong with that request. Please try again.