elm-explorations / webgl

Functional rendering with WebGL in Elm
https://package.elm-lang.org/packages/elm-explorations/webgl/latest/
BSD 3-Clause "New" or "Revised" License
117 stars 17 forks source link

Version 1.1.0 Runtime error "Uncaught Error: Trying to use (==)" #14

Open justgook opened 5 years ago

justgook commented 5 years ago

Uncaught Error: Trying to use (==) on functions. There is no way to know if functions are "the same" in the Elm sense. Read more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.

Ellie

module Main exposing (main)

import Browser
import Html exposing (Html)
import Json.Decode exposing (Value)
import Task exposing (Task)
import WebGL.Texture as WebGL

init _ =
    ( ()
    --here is problem
    , Task.map2 (==) (WebGL.load image) (WebGL.load image)
        |> Task.attempt identity
    )

main : Program Value () (Result WebGL.Error Bool)
main =
    Browser.element
        { init = init
        , view = \_ -> Html.text "Success"
        , subscriptions = \_ -> Sub.none
        , update = \_ m -> ( m, Cmd.none )
        }

image =
    "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mPUDLS6DAAC6AGJTI9bHgAAAABJRU5ErkJggg=="