4 ms·
I can see that working for a functional language. But how do you specify the side effects?
by amelius 9y ago
I can see that working for a functional language. But how do you specify the side effects?
- ch4s3 9y agoYou would have to assert equality on the value of the data/file/whatever being mutated. Here's an example: ##Examples iex> user = Repo.insert!(%MyApp.User{id: 1, some_state: "whatever"}) ...> {:ok, user} = MyApp.Users.DataTransformer.transform_with_effects(user) ...> Repo.one(where: MyApp.User.id == 1).some_state "new state"