Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iElm-Tech-JB.pdf

Ulric Wilfred
January 18, 2018
88

 iElm-Tech-JB.pdf

Ulric Wilfred

January 18, 2018
Tweet

Transcript

  1. 0. It’s a Formal Presentation. — iElm _!3 @JetBrains. All

    rights reserved (Not Boring. Just different)
  2. 1. 3D Graphics / Visual Programming for Functional Languages —

    • DrRacket has an awesome library and REVL for 3D: 
 https://docs.racket-lang.org/pict3d/combining-scenes.html • Fluxus is an awesome tool by itself: http://www.pawfal.org/fluxus/ • Libfive, based on Guille Scheme: https://libfive.com/studio/ • Haskell for Mac, an interactive playground: http://haskellformac.com/haskell-for-mac-games-in- haskell.html • Swift Interactive Playgrounds: https://developer.apple.com/swift/playgrounds/ • Luna Language: http://luna-lang.org/ iElm _!4 @JetBrains. All rights reserved
  3. 1. Pict3D from DrRacket — iElm _!5 @JetBrains. All rights

    reserved http://docs.racket-lang.org/pict3d/constructors.html
  4. 1. Fluxus (PLT Scheme) — iElm _!6 @JetBrains. All rights

    reserved https://github.com/zzkt/fluxus
  5. 1. Studio from LibFive — iElm _!7 @JetBrains. All rights

    reserved https://libfive.com/studio/
  6. 1. Haskell for Mac — iElm _!8 @JetBrains. All rights

    reserved http://haskellformac.com/
  7. 2. 3D Graphics / Visual Programming for Functional Languages for

    Web — iElm _!11 @JetBrains. All rights reserved
  8. 2. Eve by Chris Granger — iElm _!12 @JetBrains. All

    rights reserved https://www.youtube.com/watch?v=5V1ynVyud4M
  9. 2. Aurora by Chris Granger — iElm _!13 @JetBrains. All

    rights reserved https://www.youtube.com/watch?v=L6iUm_Cqx2s
  10. 2. Chris Granger: in Search of Tomorrow — iElm _!14

    @JetBrains. All rights reserved https://www.youtube.com/watch? v=VZQoAKJPbh8&t=1047 Failed
  11. 4. Elm is — • Created by one man, so

    — monarchy • Functionaλ • Strict Types • Fast and Easy way to Haskell (through PureScript) • The Elm Architecture inspired Redux 
 (though it’s actually just an updates fold, known for years) • Mathematical! iElm _!19 @JetBrains. All rights reserved
  12. 4. 2D: elm-lang/svg — iElm _!22 @JetBrains. All rights reserved

    view : Model -> Html Msg view model = let angle = turns (Time.inMinutes model) handX = toString (50 + 40 * cos angle) handY = toString (50 + 40 * sin angle) in svg [ viewBox "0 0 100 100", width "300px" ] [ circle [ cx "50", cy "50", r "45", fill "#0B79CE" ] [] , line [ x1 "50", y1 "50", x2 handX, y2 handY , stroke "#023963" ] [] ]
  13. 4. 2D: evancz/elm-graphics (former Collage) — iElm _!23 @JetBrains. All

    rights reserved main : Element main = collage 300 300 (star blue) triangle color size angle = ngon 3 size |> filled color |> rotate (degrees angle) star color = map2 (triangle color) [100, 100] [30, 90]
  14. 4. 3D: elm-community/webgl — iElm _!25 @JetBrains. All rights reserved

    https://github.com/elm-community/webgl/blob/master/examples/first-person.elm
  15. 4. 3D: elm-community/webgl -> GLSL — iElm _!26 @JetBrains. All

    rights reserved type alias Vertex = { position : Vec3 , color : Vec3 }
 
 type alias Uniforms = { perspective : Mat4 } mesh : Mesh Vertex mesh = WebGL.triangles [ ( Vertex (vec3 0 0 0) (vec3 1 0 0) , Vertex (vec3 1 1 0) (vec3 0 1 0) , Vertex (vec3 1 -1 0) (vec3 0 0 1) ) ] vertexShader : Shader Vertex Uniforms { vcolor : Vec3 } vertexShader = [glsl| attribute vec3 position; attribute vec3 color; uniform mat4 perspective; varying vec3 vcolor; void main () { gl_Position = perspective * vec4(position, 1.0); vcolor = color; } |] fragmentShader : Shader {} Uniforms { vcolor : Vec3 } fragmentShader = [glsl| precision mediump float; varying vec3 vcolor; void main () { gl_FragColor = vec4(vcolor, 1.0); } |]
  16. 4. 3D: TheSeamu5/GraphicsEngine — iElm _!27 @JetBrains. All rights reserved

    import Engine (render, cube, pyramid, scene) import Math.Vector3 (vec3) myCube = { cube | position <- vec3 0 0 0, rotation <- vec3 45 0 45, scale <- vec3 1.5 1.5 1.5 } myPyramid = { pyramid | position <- vec3 2 0 0, scale <- vec3 0.5 1 0.5 } myScene = { scene | objects <- [myCube, myPyramid] } main = render myScene
  17. 4. 3D: shamansir/elm-fluxus — iElm _!29 @JetBrains. All rights reserved

    https://github.com/shamansir/elm-fluxus import Math.Vector3 as Vec3 exposing (Vec3, vec3) import Fluxus.Program as Fx import Fluxus.State exposing ( ..) import Fluxus.Primitive as Primitive exposing ( ..) drawRow : Int -> State -> State drawRow count state = if (count > 0) then state |> translate (vec3 4 0 0) |> drawCube |> rotate (vec3 (10 * (sin (time state))) 0 0) |> withState (\state -> state |> rotate (vec3 0 25 0) |> drawRow (count - 1) ) |> withState (\state -> state |> rotate (vec3 0 -25 0) |> drawRow (count - 1) ) else state main : Fx.FluxusProgram main = Fx.everyFrame (drawRow 10) Failed
  18. 4. 3D: shamansir/elm-fluxus — iElm _!30 @JetBrains. All rights reserved

    https://github.com/shamansir/elm-fluxus drawRow count state = if (count > 0) then state |> translate (vec3 4 0 0) |> drawCube |> rotate (vec3 (10 * (sin (time state))) 0 0) |> withState (\state -> state |> rotate (vec3 0 25 0) |> drawRow (count - 1) ) |> withState (\state -> state |> rotate (vec3 0 -25 0) |> drawRow (count - 1) ) else state main = Fx.everyFrame (drawRow 10) Failed
  19. 5. mukeshsoni: Frolic for Atom — iElm _!32 @JetBrains. All

    rights reserved https://atom.io/packages/elm-instant
  20. 5. No Type Information — iElm _!35 @JetBrains. All rights

    reserved type Raw = A.Located Raw' data Raw' = RLambda Raw Raw | RVar Text | RType Var.Raw | RApp Raw [Raw] | RRecord [(A.Located Text, Raw)] (Maybe Raw) data Canonical = Lambda Canonical Canonical | Var Text | Type Var.Canonical | App Canonical [Canonical] | Record [(Text, Canonical)] (Maybe Canonical) | Aliased Var.Canonical [(Text, Canonical)] (Aliased Canonical) deriving (Eq, Ord) data Aliased t = Holey t | Filled t deriving (Eq, Ord)