Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing Haskell modules

Tags:

haskell

leksah

I'm new to Haskell. How come when I try to use Days from Data.Time I get this error:

Could not find module `Data.Time':
      It is a member of the hidden package `time-1.1.4'.
      Perhaps you need to add `time' to the build-depends in your .cabal file.

I am importing Data.List and Control.Monad, and neither gives me this error message, but the code import Data.Time does.

What am I missing?

Thanks for the help!

EDIT: I'm getting a similar error message when I use: import Directory

Thanks guys, your answers got me on track!

like image 988
Alex Baranosky Avatar asked Nov 13 '10 01:11

Alex Baranosky


People also ask

What are the Haskell modules for?

Haskell modules are a useful way to group a set of related functionalities into a single package and manage different functions that may have the same names. The module definition is the first thing that goes in your Haskell file. the name of the module begins with a capital letter; each file contains only one module.

How do I load a file into Haskell?

Basic Haskell Commands :quit (or :q) :load [filename] (or :l [filename]) :reload -- reload the current file set after you'ved edited it (or :r) :cd -- change to another directory.

What is a qualified import?

A qualified import allows using functions with the same name imported from several modules, e.g. map from the Prelude and map from Data.

What is prelude Haskell?

Prelude is a module that contains a small set of standard definitions and is included automatically into all Haskell modules.


1 Answers

Fire up Leksah with this project, open the package menu and select "edit package" from it. Now, choose "dependencies" and add the dependency you need (in your case time). You may also choose a version.

PS: Don't forget to hit the "save" button afterwards. (I think this is a design failure...).

like image 73
fuz Avatar answered Sep 20 '22 08:09

fuz