# Couldn't match expected type \`http-client-0.6.4:Network.HTTP.Client.Types.ManagerSettings' with actual type \`http-client-0.5.14:Network.HTTP.Client.Types.ManagerSettings'

**URL:** <https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367>\
**Category:** Learn\
**Created:** [August 12, 2020, 10:41pm UTC](https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367 "2020-08-12T22:41:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![guerlando](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@guerlando](https://discourse.haskell.org/u/guerlando)\
**Post date:** [August 12, 2020, 10:41pm UTC](https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367/1 "2020-08-12T22:41:01Z")

</div>

I’m trying to compile a simple telegram api example;

```
{-# LANGUAGE OverloadedStrings #-}

import Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import Web.Telegram.API.Bot

main :: IO ()
main = do
  manager <- newManager tlsManagerSettings
  res <- getMe token manager
  case res of
    Left e -> do
      putStrLn "Request failed"
      print e
    Right Response { result = u } -> do
      putStrLn "Request succeded"
      print $ user_first_name u
  where token = Token "bot824086589:AAESEC1deeeMdTLLg7ga4AxqY3L8sK49J2s" -- entire Token should be bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11

```

but I’m getting:

```
main.hs:11:25: error:
    * Couldn't match expected type `http-client-0.6.4:Network.HTTP.Client.Types.ManagerSettings'
                  with actual type `http-client-0.5.14:Network.HTTP.Client.Types.ManagerSettings'
      NB: `http-client-0.5.14:Network.HTTP.Client.Types.ManagerSettings'
            is defined in `Network.HTTP.Client.Types'
                in package `http-client-0.5.14'
          `http-client-0.6.4:Network.HTTP.Client.Types.ManagerSettings'
            is defined in `Network.HTTP.Client.Types'
                in package `http-client-0.6.4'
    * In the first argument of `newManager', namely
        `tlsManagerSettings'
      In a stmt of a 'do' block: manager <- newManager tlsManagerSettings
      In the expression:
        do { manager <- newManager tlsManagerSettings;
             res <- getMe token manager;
             case res of {
               Left e -> do { ... }
               Right (Response {result = u}) -> do { ... } } }

```

I think that the import isn’t specific so it imports the newest version of the library but it needs the old one. Is it possible for me to specify the version when importing? If not, then how can I delete the newest one? I don’t know how it got there, I simply did

`cabal install telegram-api`

---

<div class="post-metadata">

**Author:** ![guerlando](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@guerlando](https://discourse.haskell.org/u/guerlando)\
**Post date:** [August 12, 2020, 11:23pm UTC](https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367/2 "2020-08-12T23:23:26Z")

</div>

I tried creating a cabal project, then:  
Preprocessing executable ‘telegram-tests’ for telegram-tests-0.1.0.0…  
[1 of 1] Compiling Main ( Main.hs, dist/build/telegram-tests/telegram-tests-tmp/Main.o )

```
Main.hs:3:1: error:
    Failed to load interface for `Network.HTTP.Client'
    It is a member of the hidden package `http-client-0.6.4'.
    Perhaps you need to add `http-client' to the build-depends in your .cabal file.
    It is a member of the hidden package `http-client-0.5.14'.
    Perhaps you need to add `http-client' to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

Main.hs:4:1: error:
    Failed to load interface for `Network.HTTP.Client.TLS'
    It is a member of the hidden package `http-client-tls-0.3.5.3'.
    Perhaps you need to add `http-client-tls' to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.

```

then I did

```
  -- Other library packages from which modules are imported.
  build-depends: base >=4.9 && <4.10,
                       telegram-api >= 0.7,
                       http-client >= 0.6.4,
                       http-client-tls >= 0.3.5.3

```

but I get

```
cabal run
./telegram-tests.cabal has been changed. Re-configuring with most recently
used options. If this fails, please run configure manually.
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
trying: telegram-tests-0.1.0.0 (user goal)
next goal: http-client-tls (dependency of telegram-tests-0.1.0.0)
rejecting: http-client-tls-0.3.5.3/installed-KZY... (conflict: http-client-tls
=> http-client==0.5.14/installed-5k5..., telegram-tests => http-client>=0.6.4)
Dependency tree exhaustively searched.
Trying configure anyway.
Configuring telegram-tests-0.1.0.0...
cabal: Encountered missing dependencies:
http-client >=0.6.4, http-client-tls >=0.3.5.3
```

---

<div class="post-metadata">

**Author:** ![fosskers](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/fosskers/32/3744_2.png) [@fosskers](https://discourse.haskell.org/u/fosskers)\
**Post date:** [August 12, 2020, 11:33pm UTC](https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367/3 "2020-08-12T23:33:23Z")

</div>

Ah it looks like `telegram-api` is somewhat old (2018), pinned to a number of old versions of libraries. I was going to suggest using `stack` to get around dependency headaches, but it wouldn’t solve the problem here.

How are you invoking `cabal`? Are you using `new-build`?

**EDIT:** Although it looks like the Github repo for `telegram-api` has been updated as recently as mid-2019: [https://github.com/klappvisor/haskell-telegram-api](https://github.com/klappvisor/haskell-telegram-api)

---

<div class="post-metadata">

**Author:** ![guerlando](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@guerlando](https://discourse.haskell.org/u/guerlando)\
**Post date:** [August 12, 2020, 11:49pm UTC](https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367/4 "2020-08-12T23:49:26Z")

</div>

I dont know what new-build is, I just installed

`haskell-platform`

and I did

`cabal init`

So if the repo was updated then why I still get errors?

---

<div class="post-metadata">

**Author:** ![fosskers](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/fosskers/32/3744_2.png) [@fosskers](https://discourse.haskell.org/u/fosskers)\
**Post date:** [August 13, 2020, 12:01am UTC](https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367/5 "2020-08-13T00:01:37Z")

</div>

After going onto [Hackage](http://hackage.haskell.org/) and staring at the bounds enough for the versions you’re trying to get, I figured it out. The version of `http-client` you’re asking for in your `.cabal` is too new. `telegram-api` wants something in the `0.5` range. If you lower that bound, it should compile.

---

<div class="post-metadata">

**Author:** ![guerlando](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@guerlando](https://discourse.haskell.org/u/guerlando)\
**Post date:** [August 13, 2020, 12:25am UTC](https://discourse.haskell.org/t/couldnt-match-expected-type-http-client-0-6-4-network-http-client-types-managersettings-with-actual-type-http-client-0-5-14-network-http-client-types-managersettings/1367/6 "2020-08-13T00:25:28Z")

</div>

thanks, it worked with

```
  -- Other library packages from which modules are imported.
  build-depends: base >=4.9 && <4.10,
                       telegram-api >= 0.7,
                       http-client <= 0.5.14,
                       http-client-tls <= 0.3.5.3
```
