Feed Aggregator Page 676
Rendered on Sat, 27 Nov 2021 18:02:35 GMT
Rendered on Sat, 27 Nov 2021 18:02:35 GMT
via Elm - Latest posts by @hans-helmut Hans-Helmut on Sat, 27 Nov 2021 17:13:36 GMT
Hello, made this for you: Ellie
I introduced a flag to avoid double counting.
via Elm - Latest posts by @benjamin-thomas Benjamin Thomas on Sat, 27 Nov 2021 13:56:11 GMT
Hello,
I’m playing around with the playground library and can’t figure something out, I think this little demo of a bouncing ball should speak for itself :
https://ellie-app.com/fXBdXQh5pWQa1
The culprit is explained at line #27, and I’m not quite sure sure how to solve registering “ceiling hits”.
I’d also like to register a change of behavior every time x
crosses zero so ideally I’m looking for a generic solution.
Another way to look at this, is that I’d like to register a change of behavior at the beginning, middle or end of the wave
function cycle.
I thought about accumulating x values to later apply a modulo operation but that seems too complicated as the initial x value is dependent on time plus I would have to track previous x values so I’m guessing I must be missing something obvious.
Any ideas?
via Elm - Latest posts by @PascalLeMerrer Pascal Le Merrer on Sat, 27 Nov 2021 12:38:22 GMT
By giving a direct access to JavaScript, you would loose the guarantees the Elm compiler offers (no runtime errors) and probably its ability to make a so aggressive tree shaking.
via Elm - Latest posts by @rupert Rupert Smith on Sat, 27 Nov 2021 09:46:15 GMT
My intention is to order them by impact of the fix on the rest of the system. Things that can be fixed in isolation are the lowest hanging fruit. So roughly in order of how I arranged the checks in the spreadsheet:
But yes, you could play around with the order based on a number of other factors too.
via Elm - Latest posts by @rupert Rupert Smith on Sat, 27 Nov 2021 09:39:56 GMT
That is sort of the function of the Change to API Behaviour and API Addition checks - changes to a core API might be one way to fix those, but external package might be a better way, especially if the core API is arguably not broken in the first place.
This one is a good example of that; is not allowing 4.
to parse as an Int a bug or a feature?
deadEndsToString
would be fine in an external package, if it were not for the fact that it already exists in elm/parser
and throws a runtime exception. Fixing it in an external package would still leave that broken code in place.
But yes, good idea, I will add a column for Fixable in Non-Core Package.
via Elm - Latest posts by @opvasger Asger Nielsen on Sat, 27 Nov 2021 08:54:42 GMT
Manipulating compiler-output with scripts works perfectly well - we could make a bunch of those in a Git-repo to support various browser APIs, fix issues, and make performance-improvements.
elm-optimize-level-2 sort of does this
I do this a lot instead of complaining about having stuff done elsewhere
via Elm - Latest posts by @berend Berend de Boer on Sat, 27 Nov 2021 01:54:57 GMT
I think nobody wants to change Elm, but would like to use Elm in more cases. Supporting certain JavaScript browser APIs requires the ability to use JavaScript more directly. I.e. it would be good if you could write core libraries more easily to allow for experimentation.
via Elm - Latest posts by @lucamug on Sat, 27 Nov 2021 01:27:29 GMT
Is not the modBy 0 1
runtime exception an expected behaviour? I think this was left as it is for performances reason. If performance is not needed, is possible to wrap it in a safeModBy
that add a check for the parameter to be not zero.
safeModBy : Int -> Int -> Maybe Int
safeModBy a b =
if a == 0 then
Nothing
else
Just (modBy a b)
Maybe modBy
should be ranamed unsafeModBy
?
Not sure if I remember correctly
via Elm - Latest posts by @matt.cheely Matt Cheely on Sat, 27 Nov 2021 01:01:06 GMT
I was looking through these and one thing that might be worth adding to the analysis is a “fixable in external package” check. As an example, elm/parser
's missing deadEndsToString
doesn’t use any private information that I can see, so it would be feasible to implement it in a parser-extras
or parser-patch
library, and share that through the community. I suspect that could be true for most of these that don’t involve bugs in native code or re-implementation of operators.
via Elm - Latest posts by @system system on Fri, 26 Nov 2021 20:44:02 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @AvailableUsername on Fri, 26 Nov 2021 20:10:35 GMT
Update: as planned, I’ve created a helper library that makes the gesture events from Hammer.js easy to use with Elm.
https://package.elm-lang.org/packages/leforestier/elm-hammer-events/latest/
Hammer.js is actually doing all the work of gesture detection, and it’s pretty good at it. Now you can use events attributes such as onSwipe
, onSwipeLeft
, onPress
, onRotate
etc… in your Elm application and it’s as easy as using onClick.
via Elm - Latest posts by @rupert Rupert Smith on Fri, 26 Nov 2021 17:34:14 GMT
Original sheet for gathering issues is here. This is editable if you want to add any more:
I have analyzed what was posted in the original sheet, and started looking through the pull requests. Output of the analysis being prepared here:
via Elm - Latest posts by @PascalLeMerrer Pascal Le Merrer on Fri, 26 Nov 2021 07:30:30 GMT
I hosted a new workshop a few days ago.
I made a new attempt with Codesanbox.io and it was quite satisfying. I assume the issues I encountered the first time I give it a try were temporary or have been fixed.
pros:
cons:
via Elm - Latest posts by @jerith Matt McHenry on Fri, 26 Nov 2021 03:53:10 GMT
I did encounter a show-stopper bug in elm/core
in my app in Jan. 2019. It was fixed in Nov. 2019.
After waiting about a month for my PR to be merged, I began applying the fix in my nix build script. When the fix was eventually merged, I updated and stopped patching.
Should I encounter any other show-stoppers in elm/*
code in the future, I plan to use a similar approach. The main downside is that the fix didn’t kick in during development, only in “real” builds. (In this case, that was fine, I could just avoid the known landmine of albums containing more than 100 photos during development.)
via Elm - Latest posts by @system system on Thu, 25 Nov 2021 22:39:14 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @system system on Thu, 25 Nov 2021 15:20:11 GMT
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
via Elm - Latest posts by @Janiczek Martin Janiczek on Thu, 25 Nov 2021 14:19:53 GMT
Just to further the points in 3. a little, in addition to @pdamoc 's proof of concept with patching ELM_HOME
linked above I’ve started dreaming up a format of how these “patched” snapshots could be described declaratively and applied.
I’m sure there is a bunch of other prior art in all of the elm-git-install
and shelm
-like tools that we could explore.
Here’s my noodling:
elm-patchwork.json
{
"elmVersion": "0.19.1",
"packages": {
"elm/core": {
"version": "1.0.5",
"base": {
"gitRepoUrl": "https://github.com/elm/core",
"gitCommitHash": "84f38891468e8e153fc85a9b63bdafd81b24664e"
},
"patchPlan": [
{
"name": "List.concatMap performance improvements",
"filePath": "./patches/elm-core-1.0.5-list-concatmap.patch"
}
]
}
}
}
consumed by some tool into types like:
{-| The top-level type corresponding to the elm-patchwork.json file
-}
type alias Project =
{ elmVersion : String -- "0.19.1"
, packages : List Package
}
type alias Package =
{ name : String -- "elm/core"
, version : String -- "1.0.5"
, base : PackageBase
, patches : List Patch
}
type PackageBase
= BaseFromGit
{ gitRepoUrl : String -- not strictly GitHub?
, gitCommitHash : String -- this is how we'll download that package
}
| BaseFromFilesystem
{ folderPath : String -- "./patchwork/bases/elm/core/hacked-1.0.5"
}
type alias Patch =
{ name : String -- "List.concat: performance improvement"
, contents : PatchContents
}
type PatchContents
= PatchFromGit
{ gitRepoUrl : String -- not strictly GitHub?
, gitCommitHash : String -- this is how we'll download that patch
, filePath : String -- "patches/elm-core-1.0.5-list-concat.patch"
}
| PatchFromFilesystem
{ filePath : String -- "./patches/elm-core-1.0.5-list-concat.patch"
}
via Elm - Latest posts by @ben-t on Thu, 25 Nov 2021 13:25:57 GMT
Thank you very much, @albertdahlin! I updated the to add the common fields for my own understanding here.
In practice, the JSON I’m decoding has more than 8 fields so I’ve been using Json.Decode.Pipeline
for the decoding, which seems to be causing some issues still. But with the help I’ve received from this thread, I think I should be able to get through it now.
I also found Json.Decode.Extra.when
which seems like it would be another way to solve this problem. (Edit: I just needed to use custom ...
instead of required "type" ...
at the appropriate point in the pipeline).
Thanks again for all the help!
via Planet Lisp by on Thu, 25 Nov 2021 13:05:57 GMT
It seems that my article about the existence in the Lisp community of rather noisy people who seem to enjoy complaining rather than fixing things has atracted some interest. Some things in it were unclear, and some other things seem to have been misinterpreted: here are some corrections and clarifications.
First of all some people pointed out, correctly, that LispWorks is expensive if you live in a low-income country. That’s true: I should have been clearer that I believe the phenonenon I am describing is exclusively a rich-world one. I may be incorrect but I have never heard anyone from a non-rich-world country doing this kind of destructuve whining.
It may also have appeared that I am claiming that all Lisp people do this: I’m not. I think the number of people is very small, and that it has always been small. But they are very noisy and even a small number of noisy people can be very destructive.
Some people seem to have interpreted what I wrote as saying that the current situation was fine and that Emacs / SLIME / SLY was in fact the best possible answer. Given that my second sentence was
[Better IDEs] would obviously be desirable.
this is a curious misreading. Just in case I need to make the point any more strongly: I don’t think that Emacs is some kind of be-all and end-all: better IDEs would be very good. But I also don’t think Emacs is this insurmountable barrier that people pretend it is, and I also very definitely think that some small number of people are claiming it is because they want to lose.
I should point out that this claim that it is not an insurmountable barrier comes from some experience: I have taught people Common Lisp, for money, and I’ve done so based on at least three environments:
None of those environments presented any significant barrier. I think that LW was probably the most liked but none of them got in the way or put people off.
In summary: I don’t think that the current situation is ideal, and if you read what I wrote as saying that you need to read more carefully. I do think that the current situation is not going to deter anyone seriously interested and is very far from the largest barrier to becoming good at Lisp. I do think that, if you want to do something to make the situation better then you should do it, not hang around on reddit complaining about how awful it is, but that there are a small number of noisy people who do exactly that because, for them, no situation would be ideal because what they want is to avoid being able to get useful work done. Those people, unsurprisingly, often become extremely upset when you confront them with this awkward truth about themselves. They are also extremely destructive influences on any discussion around Lisp. (Equivalents of these noisy people exist in other areas, of course.) That’s one of the reasons I no longer participate in the forums where these people tend to exist.
(Thanks to an ex-colleague for pointing out that I should perhaps post this.)
via Elm - Latest posts by @jfmengels Jeroen Engels on Thu, 25 Nov 2021 12:44:46 GMT
I think that if the community were to do be pro-active in solving the mentioned issues, this is likely the way to go, as this is the least diverging or obtrusive solution.
From looking at the Google sheet link with the list of issues, most issues are located in core libraries, not in the compiler. Other issues (like 2 ^ -1
maybe?) could be patched by altering the compiled code. A combination of the 2 would resolve most problems I think.
Forking the compiler does not seem that “necessary” to me, and it would by far be the most arduous task as well, and I don’t think it’s cost-effective to do so.
On a separate note, as a tooling author, I am quite worried about the directions this may go. I don’t think me and other tooling authors want to support both Elm and a fork (or several forks), as that could be a lot of work for us, and each individual author would need to be convinced individually.
If some decide to fork Elm, my advice if you want to continue using Elm tooling (IDEs, elm-review
, …) is to not change anything about Elm’s workings. For instance (but not limited to):
elm.json
nor change its behaviourMost tools out there already support passing an Elm binary as an argument, so an alternative compiler would be very easy to support, as long as it works almost exactly like the Elm compiler.
That is why I am thinking that applying patches to the packages and altering the compiled source code is probably the way to go. Users still get to benefit from Elm tooling, tooling authors don’t have to spend time supporting a fork. And also, we probably then don’t need to change the name of the fork because there wouldn’t be a fork, just an additional tool to point people to. elm-optimize-level-2
kind of already does this (note that this would not be the tool to do this), and it didn’t have to fork the project.
I would urge whoever that feels like taking up these task to change as little as possible to Elm in their quest to solve the issues mentioned in this thread.