elm-explorations / elm-explorations/webgl

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

Open
#14 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Elm
Stars
123
Forks
17
PR merge metrics
No merged PRs in 30d

Description

>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](https://ellie-app.com/5xVVMb3S4f6a1)

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

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.