Skip to content

Commit

Permalink
Update for 0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
process-bot committed May 20, 2016
1 parent 93bf746 commit 35fde46
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 63 deletions.
9 changes: 5 additions & 4 deletions elm-package.json
@@ -1,6 +1,6 @@
{
"version": "2.0.0",
"summary": "an experimental library for easily updating nested records",
"version": "2.0.1",
"summary": "an experimental library for working with records",
"repository": "https://github.com/evancz/focus.git",
"license": "BSD3",
"source-directories": [
Expand All @@ -10,7 +10,8 @@
"Focus"
],
"dependencies": {
"elm-lang/core": "2.0.0 <= v < 4.0.0"
"elm-lang/core": "4.0.0 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
"elm-version": "0.17.0 <= v < 0.18.0"
}
63 changes: 63 additions & 0 deletions examples/Physics.elm
@@ -0,0 +1,63 @@
import Focus exposing (..)
import Html exposing (..)



-- OBJECTS


type alias Object =
{ position : Point
, velocity : Point
}


type alias Point =
{ x : Float
, y : Float
}



-- DO STUFF


main : Html msg
main =
text (toString (step 1.5 object))


object : Object
object =
Object (Point 3 4) (Point 1 1)


step : Float -> Object -> Object
step dt object =
object
|> update (position => x) (\px -> px + object.velocity.x * dt)
|> update (position => y) (\py -> py + object.velocity.y * dt)



-- FOCI


x : Focus { r | x:a } a
x =
create .x (\f r -> { r | x = f r.x })


y : Focus { r | y:a } a
y =
create .y (\f r -> { r | y = f r.y })


position : Focus { r | position : a } a
position =
create .position (\f r -> { r | position = f r.position })


velocity : Focus { r | velocity : a } a
velocity =
create .velocity (\f r -> { r | velocity = f r.velocity })
15 changes: 0 additions & 15 deletions examples/elm-package.json

This file was deleted.

43 changes: 0 additions & 43 deletions examples/src/Physics.elm

This file was deleted.

2 changes: 1 addition & 1 deletion src/Focus.elm
@@ -1,4 +1,4 @@
module Focus (Focus, get, set, update, (=>), create) where
module Focus exposing (Focus, get, set, update, (=>), create)
{-| Our goal is to update a field deep inside some nested records. For example,
if we want to add one to `object.physics.velocity.x` or set it to zero, we would
be writing code like this:
Expand Down

0 comments on commit 35fde46

Please sign in to comment.