Final Edit
Is there perhaps something wrong with my version of GHC?
Absolutely yes, there is something wrong, is too old, to be precise:
GHC-6.12 / base-4.2
(from 2010, which is the time of the Semigroup package) -- thanks so much @leftaroundabout and @Thomas M. DuBuisson for the contribution!
And that package has not the (Semigroup ((<>)))
function. Hence the error you see.
Edit 2
After comments, I tried to reproduce the OP environment to reproduce the error too, I installed in stack the ghc version 7.10.3
, this is how looks the stack.yaml file:
resolver: lts-6.27
system-ghc: false
packages:
- .
And after ruining a base stack project with a Main.hs file containing:
module Main where
import Data.Semigroup
main :: IO ()
main = do
putStrLn "Hello"
putStrLn "World"
the error I got is
/home/damian/test-semigroup/app/Main.hs:3:8:
Could not find module ‘Data.Semigroup’
Use -v to see a list of the files searched for.
-- While building package test-semigroup-0.1.0.0 using:
/home/damian/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.22.5.0_ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build lib:test-semigroup exe:test-semigroup-exe --ghc-options ""
Process exited with code: ExitFailure 1
The same happend with older versions:
I couldt try with:
- LTS 2.22 for ghc-7.8.4, published 4 years ago
Because they where to old to run with cabal
and
- LTS 0.7 for ghc-7.8.3, published 5 years ago
Because they I cannot install it in a 64bit OS...
So, to be absolutely sure I tried with all the newer LTS versions one by one, yes... one by one, It took some time but worth the shot:
- LTS 13.29 for ghc-8.6.5, published today
- LTS 13.19 for ghc-8.6.4, published 3 months ago
- LTS 13.11 for ghc-8.6.3, published 4 months ago
- LTS 12.26 for ghc-8.4.4, published 7 months ago
- LTS 12.14 for ghc-8.4.3, published 9 months ago
- LTS 11.22 for ghc-8.2.2, published 11 months ago
- LTS 9.21 for ghc-8.0.2, published a year ago
- LTS 7.24 for ghc-8.0.1, published 2 years ago
None of those ghc version could reproduce your log error, so I thought to try a typo maybe:
import Data.Semigroup (Semigroup ((<$>)))
or
import Data.Semigroup (Semigroup ((=>>)))
And those gave me your error:
/home/damian/test-semigroup/app/Main.hs:3:24: error:
Module ‘Data.Semigroup’ does not export ‘Semigroup(())’
- That means, that the
Data.Semigroup
module exists in your ghc
Semigroup((<>))
is not part of that module
Meaning, you must have one of the oldest ghc
versions...
So, I just can think that you can try:
- Reinstall your ghc, and try it to run it again.
- Please, consider using some tool such as stack
- Check your code, look out for some typos or something odd
I stand that my first answer was close though:
Edit 1
It has been added in ghc version 8.0.1
A quick search in hoogle always helps:
Here first link is semigroup <>, (<>) :: Semigroup a => a -> a -> a
and it says:

This versions is able since May 2016, and it ghc version is 8.0.1
.
To see all versions of ghc with its base versions:
https://wiki.haskell.org/Base_package