Skip to content

Using disposables around sideeffects. #1161

Answered by louthy
adameasten asked this question in Q&A
Discussion options

You must be logged in to vote

If you're using disposables that have been created outside of an Eff or Aff then you will need to force the evaluation of the Eff or Aff before disposing. Otherwise it's possible to lift disposables into the Eff or Aff expression, so they're run lazily too:

    var openFile = Eff<FileStream>(() => File.OpenText(path));

    use(openFile, stream => /* Eff expression that uses the stream */);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@adameasten
Comment options

Answer selected by adameasten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants