Pregunta

Soy nuevo en Haskell. ¿Por qué cuando intento utilizar Days de Data.Time consigo este 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.

Estoy importando Data.List y Control.Monad, y tampoco me da este mensaje de error, pero el código no import Data.Time.

¿Qué me falta?

Gracias por la ayuda!

EDIT: Estoy recibiendo un mensaje de error similar cuando uso: import Directory

Gracias chicos, sus respuestas me llegaron a la pista!

¿Fue útil?

Solución

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...).

Otros consejos

Just edit the projects .cabal file, usually in the top directory named ProjectName.cabal and find the line(s) with "build-depends:" and add "time" to this list. No need for Leksah, unless you already use it.

EDIT: To answer your question of "why now and not with module X"

Data.Time is in the time package, which evidently isn't included in your build dependencies. Similar story for the Directory module. You don't get these errors with Data.List or Control.Monad because they are part of the base package which I'll bet is in your build-deps.

On a side note, it is worth taking time to learn what modules are in base and what functionality those modules provide. Base is rather large and very useful.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top