0
votes

I'm new to haskell, and I'm trying to play around with some modules. I wrote this very basic module:

module Cube
(
    cubeArea
) where

cubeArea :: Float -> Float
cubeArea sideSize = sideSize * sideSize * sideSize

in a file named "Cube.hs". Then, I opened ghci in the cmd in the same folder the Cube.hs is. Now, when I type import Cube.hs, I get this error:

:26:8: error: parse error on input `Cube.hs'

Any idea why?

1
In ghci use :l Cube.hs to load a source file. - arrowd
import takes a module name, not a file name - chi

1 Answers

0
votes

Start GHCi:

  • ghci Cube.hs
  • stack ghci Cube.hs

While already in GHCi:

  • :l Cube.hs or :load Cube.hs
  • :r Cube.hs or :reload Cube.hs

You can see all the available types and functions by entering :browse.