So I seen another post where somebody figured this out but they just said they figured it out and I can't.
I need Data.ByteString for a project I'm working on to read a binary file. I get this error on my Main.hs.
Could not load module ‘Data.ByteString’
It is a member of the hidden package ‘bytestring-0.10.8.2’.
You can run ‘:set -package bytestring’ to expose it.
(Note: this unloads all the modules in the current scope.)
I now have this relevant code in my stack.yaml file and .cabal file respectively.
resolver: lts-14.27
packages:
- bytestring >= 0.10.8.2
- binary >= 0.7.5
library
exposed-modules:
Lib
other-modules:
Paths_maze
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
default-language: Haskell2010
executable maze-exe
main-is: Main.hs
other-modules:
Paths_maze
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, maze
, bytestring >= 0.10.8.2
, binary >= 0.7.5
default-language: Haskell2010
I don't understand what I'm missing, any help is always appreciated. Also yes I am very new to Haskell.
EDIT
(in response tosjakobi's comment)
Updates:
- .cabal file had dependencies added to it's library section
- stack.yaml file had binary and bytestring removed. This is how the stack file was originally when it was made new, except I changed the resolver based on my professors given choice. I don't even know the difference.
- package.yaml file is now below
Files (relevant code):
stack.yaml file
resolver: lts-14.27
packages:
- .
package.yaml file
dependencies:
- base >= 4.7 && < 5
library:
source-dirs: src
executables:
maze-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- maze
tests:
maze-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- maze
.cabal file
library
exposed-modules:
Lib
other-modules:
Paths_maze
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
, bytestring >= 0.10.8.2
, binary >= 0.7.5
default-language: Haskell2010
executable maze-exe
main-is: Main.hs
other-modules:
Paths_maze
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, maze
, bytestring >= 0.10.8.2
, binary >= 0.7.5
default-language: Haskell2010