Giter Site home page Giter Site logo

gleam-radiate's Introduction

Hi!

I'm Pedro, aka pta2002. I'm currently doing a masters in Computer Engineering at UMinho.

For the past few years, I've gotten deep into the Nix/NixOS ecosystem, and as such have started a few projects revolving around it, notably NixVim, which is actively getting contributions from several other people.

Contact

If you want to contact me, the best way is to send me an email: [email protected]

gleam-radiate's People

Contributors

callerofsouls avatar ghivert avatar pta2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gleam-radiate's Issues

The need for On_Before_Reload

Hello, I am new to using GitHubs features like this for requests. I hope issue was the right way to do this.

I like this library, and will be using it for a framework. I have come upon a use case I am not sure how to resolve with the current functionality.

There arises the need sometimes to waterfall changes before a reload occurs.

For instance the file structure


AutoGen
    -Models
         -model.gleam
    -Encoders
         -model_decoder.gleam
         -model_encoder.gleam

My program does these theoretical tasks

  1. uses functions to define a schema for data
  2. once the .gleam file with the schema definition is updated I would want to run the code within it to generate the true .gleam types
  3. once the types are ready for reload, I would want to call function before the reload to call my code to generate the encoders
  4. once the encoders were ready then the modules would fully reload

If for some reason the model updated before the encoders, the encoders would fail. So it needs to be synchronized somehow.

After writing all of this I thought I guess I could write a configuration file and once my schema code is reloaded, I create the models and flag a configuration file to generate the encoders before radiate detects changes so it’s done in two passes.

Error in filespy watcher

Hi !

I tried to setup an auto-reload server using Mist in Gleam, and I could not achieve it to work. I'm on a MacBook M2 right now, and after some digging in the code, it looks like filespy is warning here with filespy.Modified, but never filespy.Closed.

After copying radiate locally and modify that line to filespy.Closed | filespy.Modified -> {, it's working perfectly! I don't really know why events are not the same, I suppose it's due to OS differences.

Do you want me to open a PR for this or maybe you're planning to expand the support of filespy in the future?

For context, main file.

Details

import gleam/erlang/process
import gleam/io
import mist
import radiate

fn print_radiate_update(_state: state, path: String) {
  io.println("Change in " <> path <> ", reloading")
}

pub fn main() {
  let assert Ok(_) =
    radiate.new()
    |> radiate.add_dir(".")
    |> radiate.add_dir("src")
    |> radiate.on_reload(print_radiate_update)
    |> radiate.start()

  let assert Ok(_) =
    handle_request // My custom handler
    |> mist.new()
    |> mist.port(3000)
    |> mist.start_http()

  process.sleep_forever()
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.