Home > Enterprise >  Why am I getting Module ‘Data.CaseInsensitive’ does not export ‘CI’?
Why am I getting Module ‘Data.CaseInsensitive’ does not export ‘CI’?

Time:09-17

Trying to import CI as described in the docs but getting an error: Module ‘Data.CaseInsensitive’ does not export ‘CI’

https://hackage.haskell.org/package/case-insensitive-1.2.1.0/docs/Data-CaseInsensitive.html

What is going on?

CodePudding user response:

As your answer indicates there was a collision between the case-insensitive package, and a custom package.

You can make use of package-qualified imports by enable the PackageImports language pragma, and then specify the name of the package as a string literal, so:

{-# LANGUAGE PackageImports #-}

import "case-insensitive"           Data.CaseInsensitive  (CI)
import qualified "case-insensitive" Data.CaseInsensitive as CI

This thus allows working with two or more packages that export a module with the same name and thus avoid clashes. It will also give more helpful message if it turns out you did not expose that package (in your .cabal file for example).

CodePudding user response:

Embarrassed to admit this but I was using another library which doesn't expose CI from its module but has the same module name. Thanks everyone for your valuable time.

  • Related