Comments (3)
@alexislozano Gren doesn't have tuples. Use Unit
instead of the empty tuple, and { model = ..., command ... }
for the init
and update
return values.
from core.
For other contributors, here's the compiling gren code:
module Main exposing (..)
import Html exposing (text)
import Process
import Task exposing (Task)
import Browser
killProcessTwice : Task Never Unit
killProcessTwice =
Task.succeed Unit
|> Process.spawn
|> Task.andThen
(\pid ->
Process.kill pid
|> Task.andThen (\_ -> Process.kill pid)
)
main =
Browser.element
{ init = \Unit ->
{ model = Unit
, command = Task.perform (always Unit) killProcessTwice
}
, view = \_ -> text "oops"
, update = \_ model -> { model = model, command = Cmd.none }
, subscriptions = \_ -> Sub.none
}
from core.
@lue-bird When I try to compile with gren the example given in the linked issue:
module Main exposing (..)
import Html exposing (text)
import Process
import Task exposing (Task)
import Browser
killProcessTwice : Task Never ()
killProcessTwice =
Task.succeed ()
|> Process.spawn
|> Task.andThen
(\pid ->
Process.kill pid
|> Task.andThen (\_ -> Process.kill pid)
)
main =
Browser.element
{ init = \() ->
( ()
, Task.perform (always ()) killProcessTwice
)
, view = \_ -> text "oops"
, update = \_ model -> (model, Cmd.none)
, subscriptions = \_ -> Sub.none
}
I get an error about empty tuples:
$ gren make src/Main.gren
Detected problems in 1 module.
-- PROBLEM IN TYPE ANNOTATION ------------------------------------ src/Main.gren
I was partway through parsing the `killProcessTwice` type annotation, but I got
stuck here:
9| killProcessTwice : Task Never ()
^
I was expecting to see a type next. Try putting Int or String for now?
Do you know what could be happening?
from core.
Related Issues (20)
- long `String` `|> Bytes.Decode.string` → heap footprint large
- `Bytes.encoder/decoder` add
- different `Bytes` lengths on `==` can still give `True` HOT 2
- decoding implementation produces runtime exception → `Nothing`
- `Result.Err` recovering
- Provide a way to unmount, or cleanup, a Gren application once it's started
- `Array` documentation example incorrect: `indexedMap (,) [ 3, 3, 3 ] == [ ( 0, 3 ), ( 1, 3 ), ( 2, 3 ) ]` HOT 1
- Add `Array.update` or similar HOT 1
- Documentation still references automatic record constructor
- Explore === undefined as alternative to Array bounds check
- Use new JS copyable methods for modifying arrays
- Improve Bytes API
- Add functions for folding over codepoints in Strings
- Use .count for when returning length of a collection isn't O(1)
- Use append and prepend for combining sequential collections
- Add indexed operations to Array
- Add `Task.execute`
- modBy crashes if given a zero HOT 3
- Add Task.onComplete
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.