2

I am using haskell 9.2.4 and I'm trying to import Data.List.Split because I want to use the splitOn function for my code.

GHCi, version 9.2.4: https://www.haskell.org/ghc/  :? for help
ghci> :l Program   -- my program imports Data.List.Split
[1 of 1] Compiling Main             ( Program.hs, interpreted )

Program.hs:1:1: error:
    Could not find module ‘Data.List.Split’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
1 | import Data.List.Split
  | ^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.

This is the error I'm getting when I'm trying to load my program. Earlier I imported Data.List which worked fine for using the filter function.

Update: when I try to import Data.List and Data.Text it now marks my filter function as an error. I am on Mac btw.

1
  • Update: when I try to import Data.List and Data.Text it now marks my filter function as an error. I am on mac btw Commented Nov 26, 2022 at 12:53

1 Answer 1

2

The Data.List.Split module is defined in the split package, you thus first install that package, for example with cabal:

cabal install split

If you import Data.Text, then this module exports a (different) filter function, hence that will result in ambiguity. You can for example import Data.Text as T and then work with T.filter if you need that function:

import qualified Data.Text as T
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.