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

Compile failure w/ pre-AMP base #29

Open
hvr opened this issue Apr 15, 2017 · 1 comment
Open

Compile failure w/ pre-AMP base #29

hvr opened this issue Apr 15, 2017 · 1 comment

Comments

@hvr
Copy link

hvr commented Apr 15, 2017

Compiling with base-4.7 fails w/ the latest release (see also
http://104.239.175.197:8080/package/servant-auth-cookie):

Configuring component lib from servant-auth-cookie-0.5.0...
Preprocessing library servant-auth-cookie-0.5.0...
[1 of 1] Compiling Servant.Server.Experimental.Auth.Cookie ( src/Servant/Server/Experimental/Auth/Cookie.hs, /tmp/matrix-worker/1492269924/dist-newstyle/build/x86_64-linux/ghc-7.8.4/servant-auth-cookie-0.5.0/build/Servant/Server/Experimental/Auth/Cookie.o )

src/Servant/Server/Experimental/Auth/Cookie.hs:469:18:
    Could not deduce (Functor m) arising from a use of ‘<$>’
    from the context (MonadIO m, MonadThrow m, ServerKeySet k)
      bound by the type signature for
                 decryptCookie :: (MonadIO m, MonadThrow m, ServerKeySet k) =>
                                  AuthCookieSettings
                                  -> k
                                  -> Tagged EncryptedCookie ByteString
                                  -> m (WithMetadata Cookie)
      at src/Servant/Server/Experimental/Auth/Cookie.hs:(448,18)-(452,28)
    or from (HashAlgorithm h, BlockCipher c)
      bound by a pattern with constructor
                 AuthCookieSettings :: forall h c.
                                       (HashAlgorithm h, BlockCipher c) =>
                                       ByteString
                                       -> [ByteString]
                                       -> NominalDiffTime
                                       -> String
                                       -> ByteString
                                       -> Proxy h
                                       -> Proxy c
                                       -> CipherAlgorithm c
                                       -> CipherAlgorithm c
                                       -> AuthCookieSettings,
               in an equation for ‘decryptCookie’
      at src/Servant/Server/Experimental/Auth/Cookie.hs:453:15-37
    Possible fix:
      add (Functor m) to the context of
        the data constructor ‘AuthCookieSettings’
        or the type signature for
             decryptCookie :: (MonadIO m, MonadThrow m, ServerKeySet k) =>
                              AuthCookieSettings
                              -> k
                              -> Tagged EncryptedCookie ByteString
                              -> m (WithMetadata Cookie)
    In the expression:
      (, True)
      <$>
        maybe
          (throwM $ IncorrectMAC mac)
          (return)
          (listToMaybe . map fst . filter snd . map (id &&& checkMac)
           $ rotatedKeys)
    In a stmt of a 'do' block:
      (serverKey, renew) <- if checkMac currentKey then
                                return (currentKey, False)
                            else
                                (, True)
                                <$>
                                  maybe
                                    (throwM $ IncorrectMAC mac)
                                    (return)
                                    (listToMaybe . map fst . filter snd . map (id &&& checkMac)
                                     $ rotatedKeys)
    In the expression:
      do { currentTime <- liftIO getCurrentTime;
           let ivSize = blockSize (unProxy acsCipher)
               expSize
                 = length
                     (formatTime defaultTimeLocale acsExpirationFormat currentTime)
               ....;
           (currentKey, rotatedKeys) <- getKeys sks;
           (serverKey, renew) <- if checkMac currentKey then
                                     return (currentKey, False)
                                 else
                                     (, True)
                                     <$>
                                       maybe
                                         (throwM $ IncorrectMAC mac)
                                         (return)
                                         (listToMaybe . map fst . filter snd . map (id &&& checkMac)
                                          $ rotatedKeys);
           .... }

btw, I also notice that

flag build-examples
  description:        Build example executables.
  default:            False

should rather be declared to be a manual: True flag (so that the cabal solver doesn't consider it part of the variables it solves for).

@zohl
Copy link
Owner

zohl commented Apr 17, 2017

Hello @hvr, thank you for pointing this out!

Looks like, I forgot, that Monad m doesn't imply Functor m in GHC 7.8 (and older).
I've fixed this in v0.5.0.1 and marked v0.5.0 as deprecated.

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

2 participants