Lisplog

Blogging in Lisp

Search

Feed Aggregator Page 682

Rendered on Fri, 04 Feb 2022 08:31:31 GMT  newer latest older 

How Do You Read Types?

via Elm - Latest posts by @avh4 on Fri, 04 Feb 2022 03:57:19 GMT

This is a fun question!

I find when things get complicated, I try to use different sentence patterns for the same concepts to help distinguish between different levels of nesting. And I tend to repeat small chunks to myself and then build up larger chunks. So in your examples, I might think:

(<|) : (a → b) → a → b

  • okay, we’ve got a function
  • the first argument is another function that converts a to b
  • the second argument is an a
  • and it returns a b

(|>) : a → (a → b) → b

  • okay, we’ve got an a
  • and we’ve got a function that converts a's to b's
  • and it returns a b

(I guess I like to hype myself up by starting with “okay” :slight_smile: )

With those specific examples, I’m familiar enough with them that I wouldn’t normally think all that, but when I see functions that start to confuse me, that’s the type of self-talk I tend to fall back on.

Elm Alternative Package (Mirror) Live

via Elm - Latest posts by @turboMaCk Marek Fajkus on Thu, 03 Feb 2022 16:24:59 GMT

@rupert elm hardcoding domain would not be a problem. That domain would just got resolved to your IP. But then the certificate for https would be a problem because you can’t have valid one for that url. There would be way around that by installing certs but at that point main complications would be still with installing certs probably making simplifications insignificant.

Anyway I’m happy to say I made it work with mitmproxy as described relatively easily.

A GitHub action to avoid being caught by GitHub zip issues on CI

via Elm - Latest posts by @lydell Simon Lydell on Thu, 03 Feb 2022 16:21:51 GMT

Small note: Caching dependencies to speed up workflows - GitHub Docs

GitHub will remove any cache entries that have not been accessed in over 7 days.

So if you have a not very active repo, you might not be saved by cache.

Elm Alternative Package (Mirror) Live

via Elm - Latest posts by @rupert Rupert Smith on Thu, 03 Feb 2022 16:19:25 GMT

Not sure either of those would work. /etc/hosts because the elm compiler already has package.elm-lang.org hard coded. And DNS because its https and the compiler is checking the certificate is correct.

It has always been the plan to do a modified compiler for this project.

Elm Alternative Package (Mirror) Live

via Elm - Latest posts by @turboMaCk Marek Fajkus on Thu, 03 Feb 2022 15:56:52 GMT

Thanks @rupert

I’m really glad to see this type of solution.

I wonder if your setup also supports routing from package.elm-lang.org so it could work even without mitm with something like custom DNS or simple entry in /etc/hosts file? I think that might seem to be slightly more user friendly for some users.

Does it make sense to rely on JS libraries for simple effects s.a., Collapse?

via Elm - Latest posts by @system system on Thu, 03 Feb 2022 15:49:41 GMT

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

Elm Alternative Package (Mirror) Live

via Elm - Latest posts by @lenards Andrew Lenards on Thu, 03 Feb 2022 13:57:26 GMT

Thanks for posting this @rupert :bowing_man:

Elm Alternative Package (Mirror) Live

via Elm - Latest posts by @rupert Rupert Smith on Thu, 03 Feb 2022 12:17:11 GMT

As part of my work on an alternative package manager for Elm, I have updated its package index.

You should be able to run a build through it by doing the following:

> mv ~/.elm ~/.elm-old
> mitmdump --ssl-insecure -M '|https://package.elm-lang.org/|https://package.eco-elm.org/v1/'
> https_proxy=http://127.0.0.1:8080 elm make src/Main.elm

There is also a step needed to whitelist the mitmdump certificate authority on your local box to allow it to proxy an https endpoint - you can find instructions on how to do that here https://docs.mitmproxy.org/stable/concepts-certificates/. This is not something you should do without considering the security implications - I am ok doing it on my dev box, but not on CI through to production.

Moving your current ELM_HOME folder ~/.elm out of the way is needed, since the .zip files on my package server are different again to the ones GitHub serves. They have been stripped of everything except src/**/*.elm + README.md + LICENSE + elm.json. That is why I put (Mirror) in brackets, because it is not an exact mirror.

Currently running on a minimal AWS infrastructure, so it is not very responsive, so don’t hit it too hard.

I would be interested in hearing if anyone else is able to get it to work? or what errors you encounter when trying.

Removing the need to use mitmdump would require hacking the Elm compiler, since it hard codes https://package.elm-lang.org/. I will try and publish a hacked compiler soon (with the publish CLI option disabled), to make reaching this package mirror simpler.

Should a module expose its Msg constructors?

via Elm - Latest posts by @system system on Wed, 02 Feb 2022 21:44:43 GMT

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

Simple CSS transitions in Elm?

via Elm - Latest posts by @nsadeh Nimrod Sadeh on Wed, 02 Feb 2022 17:43:17 GMT

It’s certainly not perfect, but it works in this use case as I know there’s a limited number of items. So investing in a perfect solution is not a good tradeoff here for me.

Feel free to post an elm-animation solution for academic purposes, though! I am sure others searching for a similar answer will be grateful.

Simple CSS transitions in Elm?

via Elm - Latest posts by @romper stomper on Wed, 02 Feb 2022 16:16:37 GMT

The trick with max-height is not perfect at all, transition will consider if height is 500. So for the not known general case height solution should be more complicated, and probably implementing it with pure elm will be not trivial, is possible at all, one needs to calculate containing items heights and set it on the container element that will be transitioned. I’m not aware of other more simple solutions for this problem.

Simple CSS transitions in Elm?

via Elm - Latest posts by @nsadeh Nimrod Sadeh on Wed, 02 Feb 2022 13:42:57 GMT

I’m sure it is, I just like to have as few dependencies as possible. For a first Elm app I’d like to see if I can build it in pure elm without any additional packages at all!

Simple CSS transitions in Elm?

via Elm - Latest posts by @nsadeh Nimrod Sadeh on Wed, 02 Feb 2022 13:42:10 GMT

I changed a few things around and looks like it works for variable height now, although you have to specify a max height.

.slide {
  clear: both;
  width: 100%;
  max-height: 0px;
  overflow: hidden;
  text-align: center;
  transition: max-height .4s ease;
}

.fake-checkbox:checked+.slide {
  max-height: 500px;
}

A GitHub action to avoid being caught by GitHub zip issues on CI

via Elm - Latest posts by @mattpiz Matthieu Pizenberg on Wed, 02 Feb 2022 11:31:56 GMT

Hey guys! I’m just hearing about the zipball issue on GitHub preventing elm make to run. Turns out if your packages are cached, you don’t need to download them :wink: So ironically, GitHub actions caching are a solution to GitHub problems if you are using GitHub.

Some time ago, I published an action to help you do exactly that so I thought I’d relay it again today: GitHub - mpizenberg/elm-tooling-action: GitHub action to install Elm tools and cache ELM_HOME

The action is pretty nice, since it just requires you to add an elm-tooling.json file like this:

{
  "tools": {
    "elm": "0.19.1",
    "elm-format": "0.8.5"
  }
}

and to add the following few lines to your .github/workflows/ci.yml file and you are set! (Don’t forget to activate action both on PR and main branch).

      - name: Install elm, elm-format and cache the ELM_HOME directory
        uses: mpizenberg/elm-tooling-action@v1.2
        with:
          cache-key: elm-home-${{ hashFiles('elm-tooling.json', 'elm.json') }}

Couple remarks

There is a warning saying that you shouldn’t use it if you have a typical web project with a package.json file and follow instead the traditional elm-tooling-cli setup.

Well it was me being over cautious, and it seems that both are fine together (let me know if you have issues). So you can add the GH action just for the sake of easy caching of the elm home.

It doesn’t seem to be up to date

It is enought up to date if you are only interested in caching, elm, and elm-format. If you also want to install the latest elm-test-rs with it, I haven’t updated it yet by lack of time. PRs are welcome, please make it so I can review very easily because I don’t have much time these days.

I hope your projects are back to normal compiling! Otherwise have a look at Martin’s script to build your own cache! Build ~/.elm cache manually without checking SHA1 hashes · GitHub

:heart: And continue building with elm :heart:

Potential breaking change in github zipballs codec

via Elm - Latest posts by @francescortiz Francesc Ortiz on Wed, 02 Feb 2022 08:11:40 GMT

According to #core-coordination, github fixed the situation and it should be working for everybody now.

Simple CSS transitions in Elm?

via Elm - Latest posts by @romper stomper on Wed, 02 Feb 2022 08:03:47 GMT

Though this will only work for the content of known height.

How Do You Read Types?

via Elm - Latest posts by @plaxdan Daniel Walker on Wed, 02 Feb 2022 05:21:36 GMT

<| = converter -> thing -> result
|> = thing -> converter -> result

How Do You Read Types?

via Elm - Latest posts by @plaxdan Daniel Walker on Wed, 02 Feb 2022 05:17:00 GMT

(post deleted by author)

Travelm-Agency now supports Fluent including usage of the Intl API with Elm 0.19!

via Elm - Latest posts by @andreasmolitor Andreas Molitor on Tue, 01 Feb 2022 21:46:11 GMT

Yes, I feel similarily about the proxy hack. It works very well, but its almost as powerful as straight up kernel code. Sadly, it’s the only approach right now that allows synchronous interop, which is needed in my opinion for internationalization.

I would gladly add a command line/API option to choose between intl-proxy or elm-cldr.
The default should probably be elm-cldr if its features are enough for the given translation sets.
This shouldn’t be a problem to implement, I’m doing the same currently to avoid depending on intl-proxy if it isn’t necessary.

Travelm-Agency now supports Fluent including usage of the Intl API with Elm 0.19!

via Elm - Latest posts by @Enkidatron Ben Thomas on Tue, 01 Feb 2022 21:36:23 GMT

I am of two minds about this. On the first hand, this is both very neat and very impressive. On the other hand, intl-proxy scares me, because it brings back (somewhat limited) JS FFI and thus a lot of the concerns around Kernel code.

I have also dabbled in Elm-generating-Elm, and believe that whatever hacks you want to use during that are fine, because at the end of the process you either have valid Elm code or you don’t. However, I see in the examples that some use cases require the use of intl-proxy in the application that uses the generated code. Would you consider moving to a pure-Elm solution for locale-aware formatting if one was available?

Blatant plug: I started on such a pure-elm library, although it is not feature-rich enough yet to cover this use case: elm-cldr 1.0.0

 newer latest older