Fork me on GitHub
#integrant
<
2021-01-22
>
benny14:01:20

@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?

Michaël Salihi15:01:28

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

benny15:01:37

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

benny15:01:26

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

Michaël Salihi17:01:29

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.

Michaël Salihi17:01:56

Which editor do you use?

benny17:01:51

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

benny17:01:58

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

benny17:01:19

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)

Michaël Salihi17:01:17

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

Michaël Salihi17:01:33

So your approch seems fine for me.

benny17:01:07

is that also how you do it?

benny17:01:24

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

benny17:01:49

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

Michaël Salihi17:01:21

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.

Michaël Salihi17:01:34

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

benny17:01:52

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

benny17:01:16

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

benny17:01:22

sorry for being so difficult and thanks for your patience 🙂

Michaël Salihi17:01:04

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

Michaël Salihi17:01:53

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

Michaël Salihi22:01:11

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