softshipper
softshipper

Reputation: 34099

Do I violate the abstraction law?

I have two variables, the first with the type Either String Int and the second with the type IO (Either String Int).

As you can see, the structure of two variables are almost the same, except the second is wrapped into IO.

To make it composable, I am planing to lift both into MonadTransformer EitherT, but the first variable I have to lift into IO.

Is it wrong to lift the first variable into IO to make it composable, although there has no side effect happened on it.

It is just about to put into IO context.

Upvotes: 2

Views: 87

Answers (1)

Daniel Wagner
Daniel Wagner

Reputation: 153182

No, it is not wrong; in fact, it is encouraged.

Upvotes: 2

Related Questions