integrant

2021-01-22T10:31:15.028300Z

Hello @b Maybe my example repo here can help you: • https://github.com/PrestanceDesign/usermanager-reitit-integrant-example

benny 2021-01-22T14:54:20.029300Z

@admin055 this is already helpful, thanks! Now for your continued workflow, would you (def mydb (:database.sql/connection integrant.repl.state/system)) to continue working on this?

2021-01-22T15:01:28.029400Z

You're welcome. I'm not sure to exactly understand your question.

benny 2021-01-22T15:27:37.029600Z

Assuming you're in usermanager.model.user-manager and you want to create a new function that takes db, like get-user-by-first-name

benny 2021-01-22T15:28:26.029800Z

how would you write it? of course that's an easy example and the SQL would probably be right on the first try, but how would you interactively develop and test it in the running system

2021-01-22T17:00:29.030200Z

I use the reloaded workflow with Integrant-repl https://github.com/weavejester/integrant-repl as my example repo does. in this way it is possible to reset the app state, etc.

2021-01-22T17:00:56.030500Z

Which editor do you use?

benny 2021-01-22T17:13:51.030700Z

I use emacs and I'm trying to use the REPL workflow

benny 2021-01-22T17:14:58.030900Z

I'm sorry this may be a bit cumbersome but I'm actually not sure if other people do the kind of def I do above or how they handle iterative development on the stateful stuff

benny 2021-01-22T17:16:19.031100Z

in mount I have the state right there so I can treat it like a global (in another language), there is no disconnect between my REPL development and the application, but in integrant there has to be (at least for the parts that are iterative on the stateful stuff)

2021-01-22T17:38:17.031300Z

OK, I see. You want to keep continuing to iterate with the interactive REPL workflow.

2021-01-22T17:39:33.031600Z

So your approch seems fine for me.

benny 2021-01-22T17:40:07.031800Z

is that also how you do it?

benny 2021-01-22T17:40:24.032Z

maybe I'm not seeing an alternative approach because of my habits

2021-01-22T17:40:54.032200Z

As you can see, my deps.edn contains this :dev alias https://github.com/PrestanceDesign/usermanager-reitit-integrant-example/blob/main/deps.edn#L13

benny 2021-01-22T17:41:49.032500Z

yeah but there is no state, except the state that is handled by integrant.repl.state/system

2021-01-22T17:45:21.032700Z

I use Emacs (Spacemacs too). I have this dir-locals file https://github.com/PrestanceDesign/usermanager-reitit-integrant-example/blob/main/.dir-locals.el when I jack-in, this allows to load integrant-repl at the level of the user namespace of the REPL.

2021-01-22T17:46:34.033Z

After that you can write your new function, require it in the user ns and call it with mydbfor eg.

benny 2021-01-22T17:46:52.033200Z

so you also do the def I did above in your running system?

2021-01-22T17:47:34.033400Z

benny 2021-01-22T17:48:16.033800Z

okay thanks, so that's also how one does it in integrant 😄

benny 2021-01-22T17:50:22.034Z

sorry for being so difficult and thanks for your patience 🙂

2021-01-22T17:57:04.034200Z

It was to say that it was possible. But I think in reality with Integrant-repl it's more about using reset, etc with keyboard shortcuts as I configured for Emacs with the cider-ns-refresh hook. https://github.com/PrestanceDesign/usermanager-reitit-integrant-example/blob/main/.dir-locals.el#L5

2021-01-22T17:57:53.034500Z

After that I am not yet an expert so maybe others will have advice on this. 🙂

2021-01-22T22:29:11.034700Z

Did you already read this old post who was the first iteration of the reloaded workflow? https://www.cognitect.com/blog/2013/06/04/clojure-workflow-reloaded