On Mon, 2019-09-16 at 17:00 -0700, John Soo wrote:
> Hi Jesse,
>
> > Can somebody help me out please?
>
> I can try!
>
> Can get the contents of $GHC_PACKAGE_PATH please? Guix uses this
> environment variable that is recognized by the ghc toolchain to tell
> ghc where packages are installed.
>
> What happens if you try to load your file in ghci instead of using
> runhaskell?
>
> Good luck,
>
> - John
I wrote a script to do that (attached with output), then for each each
of the available versions, removed all ghc, logged into a virtual
terminal, ran the script, then logged out of the virtual terminal. I
did the log in/out because I previously noticed GHC_PACKAGE_PATH did
not change, even when I uninstalled everything, so I suspected it was
linked to a login script.
It appears the required modules were in GHC_PACKAGE_PATH and the
program did not have an error when I used ghc version 8.4.3
I noticed when I installed each successive version of GHC it suggests I
run a script to update the environment variables. I usually ignored it
because I did not have a problem like this before.
Case closed I guess.
GHC_PACKAGE_PATH=/home/jesse/.guix-profile/lib/ghc-8.6.5/package.conf.d
runhaskell:
tutorial.hs:2:1: error:
Could not find module ‘Text.Regex’
Perhaps you meant Text.Read (from base-4.12.0.0)
Use -v to see a list of the files searched for.
|
2 | import Text.Regex
| ^^^^^^^^^^^^^^^^^
tutorial.hs:3:1: error:
Could not find module ‘System.Random’
Use -v to see a list of the files searched for.
|
3 | import System.Random
| ^^^^^^^^^^^^^^^^^^^^
ghci:
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
Prelude> Prelude Data.List>
<no location info>: error:
Could not find module ‘Text.Regex’
Perhaps you meant Text.Read (from base-4.12.0.0)
Prelude Data.List>
<no location info>: error:
Could not find module ‘System.Random’
It is not a module in the current program, or in any known package.
Prelude Data.List> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List
Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude
Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
<interactive>:16:38: error:
Not in scope: type constructor or class ‘StdGen’
<interactive>:16:54: error:
Not in scope: type constructor or class ‘StdGen’
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
<interactive>:18:8: error: Empty 'do' block
Prelude Data.List Data.Ord>
<interactive>:19:2: error:
• Variable not in scope: putstr :: [Char] -> t
• Perhaps you meant ‘putStr’ (imported from Prelude)
Prelude Data.List Data.Ord> Leaving GHCi.
GHC_PACKAGE_PATH=/home/jesse/.guix-profile/lib/ghc-8.4.3/ghc-random-1.1.conf.d:/home/jesse/.guix-profile/lib/ghc-8.4.3/ghc-regex-compat-0.95.1.conf.d:/home/jesse/.guix-profile/lib/ghc-8.4.3/package.conf.d
runhaskell:
tutorial.hs:19:2: error:
• Variable not in scope: putstr :: [Char] -> t
• Perhaps you meant ‘putStr’ (imported from Prelude)
|
19 | putstr "Hello World! Let's have a picnic! \n"
| ^^^^^^
ghci:
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> Prelude Data.List> Prelude Data.List Text.Regex> Prelude Data.List
Text.Regex System.Random> Prelude Data.List Text.Regex System.Random Data.Ord>
Prelude Data.List Text.Regex System.Random Data.Ord> Prelude Data.List
Text.Regex System.Random Data.Ord> Prelude Data.List Text.Regex System.Random
Data.Ord> Prelude Data.List Text.Regex System.Random Data.Ord> Prelude
Data.List Text.Regex System.Random Data.Ord> Prelude Data.List Text.Regex
System.Random Data.Ord> Prelude Data.List Text.Regex System.Random Data.Ord>
Prelude Data.List Text.Regex System.Random Data.Ord> Prelude Data.List
Text.Regex System.Random Data.Ord> Prelude Data.List Text.Regex System.Random
Data.Ord> Prelude Data.List Text.Regex System.Random Data.Ord> Prelude
Data.List Text.Regex System.Random Data.Ord> Prelude Data.List Text.Regex
System.Random Data.Ord>
<interactive>:18:8: error: Empty 'do' block
Prelude Data.List Text.Regex System.Random Data.Ord>
<interactive>:19:2: error:
• Variable not in scope: putstr :: [Char] -> t
• Perhaps you meant ‘putStr’ (imported from Prelude)
Prelude Data.List Text.Regex System.Random Data.Ord> Leaving GHCi.
GHC_PACKAGE_PATH=/home/jesse/.guix-profile/lib/ghc-8.0.2/package.conf.d
runhaskell:
tutorial.hs:2:1: error:
Failed to load interface for ‘Text.Regex’
Perhaps you meant Text.Read (from base-4.9.1.0)
Use -v to see a list of the files searched for.
tutorial.hs:3:1: error:
Failed to load interface for ‘System.Random’
Use -v to see a list of the files searched for.
ghci:
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Prelude> Prelude Data.List>
<no location info>: error:
Could not find module ‘Text.Regex’
Perhaps you meant Text.Read (from base-4.9.1.0)
Prelude Data.List>
<no location info>: error:
Could not find module ‘System.Random’
It is not a module in the current program, or in any known package.
Prelude Data.List> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List
Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude
Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
<interactive>:16:38: error:
Not in scope: type constructor or class ‘StdGen’
<interactive>:16:54: error:
Not in scope: type constructor or class ‘StdGen’
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
<interactive>:18:8: error: Empty 'do' block
Prelude Data.List Data.Ord>
<interactive>:19:2: error:
• Variable not in scope: putstr :: [Char] -> t
• Perhaps you meant ‘putStr’ (imported from Prelude)
Prelude Data.List Data.Ord> Leaving GHCi.
GHC_PACKAGE_PATH=/home/jesse/.guix-profile/lib/ghc-7.10.2/package.conf.d
runhaskell:
tutorial.hs:2:8:
Could not find module ‘Text.Regex’
Perhaps you meant Text.Read (from base-4.8.1.0)
Use -v to see a list of the files searched for.
tutorial.hs:3:8:
Could not find module ‘System.Random’
Use -v to see a list of the files searched for.
ghci:
GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help
Prelude> Prelude Data.List>
<no location info>:
Could not find module ‘Text.Regex’
Perhaps you meant Text.Read (from base-4.8.1.0)
Prelude Data.List>
<no location info>:
Could not find module ‘System.Random’
It is not a module in the current program, or in any known package.
Prelude Data.List> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List
Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude
Data.List Data.Ord> Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
<interactive>:17:38:
Not in scope: type constructor or class ‘StdGen’
<interactive>:17:54:
Not in scope: type constructor or class ‘StdGen’
Prelude Data.List Data.Ord> Prelude Data.List Data.Ord>
<interactive>:19:6: parse error on input ‘=’
Prelude Data.List Data.Ord>
<interactive>:20:2:
Not in scope: ‘putstr’
Perhaps you meant ‘putStr’ (imported from Prelude)
Prelude Data.List Data.Ord> Leaving GHCi.
OUT=output.txt
echo 'GHC_PACKAGE_PATH='$GHC_PACKAGE_PATH >> $OUT
echo "runhaskell: " >> $OUT
runhaskell tutorial.hs |& cat >> $OUT
echo "ghci: " >> $OUT
ghci < tutorial.hs |& cat >> $OUT
import Data.List
import Text.Regex
import System.Random
import Data.Ord
type Point = (Float,Float)
type Color = (Int,Int,Int)
type Polygon = [Point]
type Person = [Int]
type Link =[Point]
type Placement = [(Person,Person)]
type EnergyFunction a = a -> Int
type TemperatureFunction = Int -> Int -> Float
type TransitionProbabilityFunction = Int -> Int -> Float -> Float
type MotionFunction a = StdGen -> a -> (StdGen,a)
main = do
putstr "Hello World! Let's have a picnic! \n"