elm-explorations/webgl

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

justgook opened this issue · 0 comments

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=="