Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withCompression' should take a predicate function #148

Open
hvr opened this issue Jul 8, 2012 · 0 comments
Open

withCompression' should take a predicate function #148

hvr opened this issue Jul 8, 2012 · 0 comments

Comments

@hvr
Copy link
Member

hvr commented Jul 8, 2012

The current signature reads:

withCompression' :: MonadSnap m
                 => Set ByteString    -- ^ set of compressible MIME types
                 -> m a               -- ^ the web handler to run
                 -> m ()

The use of Set seems to be too inflexible to me, e.g. if you wanted to compress all mime-types matching text/*, you'd have to enumerate them all; or if you wanted to use a HashSet instead of Set. Also, in some cases you might want to compress the data only if a certain size threshold is exceeded. Thus, I'd suggest using a predicate function with the signature :: ByteString -> Int64 -> Bool instead of a value of type Set ByteString.

PS: is there a reason, that the monadic value of m a is discarded, and is transformed into a m () action?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant