faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.28k stars 89 forks source link

how does Fay.Convert compile? #467

Closed henrylaxen closed 4 years ago

henrylaxen commented 4 years ago

Dear Adam, Chris & co., First thank you for the service you are providing by writing and maintaining fay. I would be lost without it. I have what I hope is a very simple question. When I am in the top level fay directory, I can run:

cabal v2-repl and after a few warnings, it compiles and I am greeted with the nice Fay> prompt.

However, if I descend into the src/Fay directory and type:

ghci -i.. Convert.hs

I get:

Convert.hs:58:13: error:
    • Could not deduce (ToJSON UTCTime) arising from a use of ‘toJSON’
      from the context: Data a
        bound by the type signature for:
                   encodeFay :: (GenericQ Value -> GenericQ Value) -> GenericQ Value
        at Convert.hs:(51,1)-(71,17)
...

Upon examining the code, I don't see how it can possibly ever work.
According to the Data.Aeson.Types, UTCTime should be an instance of Generic but I can't find that anywhere. What magic is going on here? Can you explain or point me in the right direction to understand this. Thanks in advance. Best wishes, Henry Laxen

swamp-agr commented 4 years ago

Hi @henrylaxen,

If you launch cabal in verbose mode:

cabal v2-repl --verbose=3

You will see that it examines both global and local package databases. Moreover, there will be cabal.project and cabal.project.local files that will bring some light on the context of ghci that was launched under the hood of cabal v2-repl.

When you execute ghci src/Fay/Conert.hs you will use only base and few more packages represented in global package database. In my case output was different:

GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /Users/agr/.ghci
[1 of 1] Compiling Fay.Convert      ( src/Fay/Convert.hs, interpreted )

src/Fay/Convert.hs:18:1: error:
    Could not find module ‘Fay.Compiler.Prelude’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
18 | import           Fay.Compiler.Prelude
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:21:1: error:
    Could not find module ‘Control.Spoon’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
21 | import           Control.Spoon
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:22:1: error:
    Could not find module ‘Data.Aeson’
    Perhaps you meant Data.Version (from base-4.14.0.0)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
22 | import           Data.Aeson
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:23:1: error:
    Could not find module ‘Data.Aeson.Types’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
23 | import           Data.Aeson.Types      (parseEither)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:25:1: error:
    Could not find module ‘Data.Generics.Aliases’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
25 | import           Data.Generics.Aliases
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:26:1: error:
    Could not find module ‘Data.HashMap.Strict’
    Perhaps you meant
      Data.IntMap.Strict (from containers-0.6.2.1)
      Data.Map.Strict (from containers-0.6.2.1)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
26 | import           Data.HashMap.Strict   (HashMap)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:27:1: error:
    Could not find module ‘Data.HashMap.Strict’
    Perhaps you meant
      Data.IntMap.Strict (from containers-0.6.2.1)
      Data.Map.Strict (from containers-0.6.2.1)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
27 | import qualified Data.HashMap.Strict   as Map
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:31:1: error:
    Could not find module ‘Data.Vector’
    Perhaps you meant Data.Functor (from base-4.14.0.0)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
31 | import           Data.Vector           (Vector)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:32:1: error:
    Could not find module ‘Data.Vector’
    Perhaps you meant Data.Functor (from base-4.14.0.0)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
32 | import qualified Data.Vector           as Vector
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
(0.14 secs,)

There were no vector, aeson, unordered-containers, syb packages.

Thanks, @swamp-agr

henrylaxen commented 4 years ago

Yes, there was a bit of setup involved which I did not include because I thought you might already know the answer off the top of you head.  Here is what I had to do to get to this point:

First I installed all of the missing modules with a script.  That I'm attaching below.  Then I had to run

ghc-pkg hidebase-compat-batteries

Attached is the output of ghc-pkg list Finally I cd'd into the directory that contained the Fay source code: /home/henry/haskell/fay/src/Fay and ran: ghci -i.. Convert.hs which produced Convert.hs:58:13: error:     • Could not deduce (ToJSON UTCTime) arising from a use of ‘toJSON’       from the context: Data a         bound by the type signature for:                    encodeFay :: (GenericQ Value -> GenericQ Value) -> GenericQ Val         at Convert.hs:(51,1)-(71,17)       or from: Data a1         bound by a type expected by the context:                    GenericQ Value         at Convert.hs:(52,5)-(62,15)  ...

So the mystery to me is why cabal v2-repl works, and ghci doesn't.  All of the needed packages (and then some because I came across this in a web app I was writing) are available either in the global database: home/henry/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d or the private database: /home/henry/.ghc/x86_64-linux-8.8.3/package.conf.d And nowhere can I find that UTCTime has a derived Generic instance, and yet the v2-repl works and ghci doesn't.  I guess my real question is why doesn't the v2-repl crash with the same error message?  Where did the magic happen? Best wishes, Henry Laxen

On Monday, April 20, 2020 13:48 CDT, Andrey Prokopenko notifications@github.com wrote:     Hi @henrylaxen, If you launch cabal in verbose mode:cabal v2-repl --verbose=3

You will see that it examines both global and local package databases. Moreover, there will be cabal.project and cabal.project.local files that will bring some light on the context of ghci that was launched under the hood of cabal v2-repl. When you execute ghci src/Fay/Conert.hs you will use only base and few more packages represented in global package database. In my case output was different:GHCi, version 8.10.1: https://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /Users/agr/.ghci [1 of 1] Compiling Fay.Convert ( src/Fay/Convert.hs, interpreted )

src/Fay/Convert.hs:18:1: error: Could not find module ‘Fay.Compiler.Prelude’ Use -v (or :set -v in ghci) to see a list of the files searched for. | 18 | import Fay.Compiler.Prelude | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:21:1: error: Could not find module ‘Control.Spoon’ Use -v (or :set -v in ghci) to see a list of the files searched for. | 21 | import Control.Spoon | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:22:1: error: Could not find module ‘Data.Aeson’ Perhaps you meant Data.Version (from base-4.14.0.0) Use -v (or :set -v in ghci) to see a list of the files searched for. | 22 | import Data.Aeson | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:23:1: error: Could not find module ‘Data.Aeson.Types’ Use -v (or :set -v in ghci) to see a list of the files searched for. | 23 | import Data.Aeson.Types (parseEither) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:25:1: error: Could not find module ‘Data.Generics.Aliases’ Use -v (or :set -v in ghci) to see a list of the files searched for. | 25 | import Data.Generics.Aliases | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:26:1: error: Could not find module ‘Data.HashMap.Strict’ Perhaps you meant Data.IntMap.Strict (from containers-0.6.2.1) Data.Map.Strict (from containers-0.6.2.1) Use -v (or :set -v in ghci) to see a list of the files searched for. | 26 | import Data.HashMap.Strict (HashMap) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:27:1: error: Could not find module ‘Data.HashMap.Strict’ Perhaps you meant Data.IntMap.Strict (from containers-0.6.2.1) Data.Map.Strict (from containers-0.6.2.1) Use -v (or :set -v in ghci) to see a list of the files searched for. | 27 | import qualified Data.HashMap.Strict as Map | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:31:1: error: Could not find module ‘Data.Vector’ Perhaps you meant Data.Functor (from base-4.14.0.0) Use -v (or :set -v in ghci) to see a list of the files searched for. | 31 | import Data.Vector (Vector) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Fay/Convert.hs:32:1: error: Could not find module ‘Data.Vector’ Perhaps you meant Data.Functor (from base-4.14.0.0) Use -v (or :set -v in ghci) to see a list of the files searched for. | 32 | import qualified Data.Vector as Vector | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Failed, no modules loaded. (0.14 secs,) There were no vector, aeson, unordered-containers, syb packages. Thanks, @swamp-agr — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

 

/home/henry/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d Cabal-3.0.1.0 array-0.5.4.0 base-4.13.0.0 binary-0.8.7.0 bytestring-0.10.10.0 containers-0.6.2.1 deepseq-1.4.4.0 directory-1.3.6.0 filepath-1.4.2.1 (ghc-8.8.3) ghc-boot-8.8.3 ghc-boot-th-8.8.3 ghc-compact-0.1.0.0 ghc-heap-8.8.3 ghc-prim-0.5.3 ghci-8.8.3 haskeline-0.7.5.0 hpc-0.6.0.3 integer-gmp-1.0.2.0 libiserv-8.8.3 mtl-2.2.2 parsec-3.1.14.0 pretty-1.1.3.6 process-1.6.8.0 rts-1.0 stm-2.5.0.0 template-haskell-2.15.0.0 terminfo-0.4.1.4 text-1.2.4.0 time-1.9.3 transformers-0.5.6.2 unix-2.7.2.2 xhtml-3000.2.2.1

/home/henry/.ghc/x86_64-linux-8.8.3/package.conf.d HTTP-4000.3.14 HUnit-1.6.0.0 MonadRandom-0.5.1.2 Only-0.1 QuickCheck-2.14 SHA-1.6.4.4 StateVar-1.2 adjunctions-4.4 aeson-1.4.7.1 ansi-terminal-0.10.3 async-2.2.2 attoparsec-0.13.2.4 auto-update-0.1.6 base-compat-0.11.1 (base-compat-batteries-0.11.1) base-orphans-0.8.2 base64-bytestring-1.0.0.3 basement-0.0.11 bifunctors-5.5.7 binary-0.8.8.0 blaze-builder-0.4.1.0 blaze-html-0.9.1.2 blaze-markup-0.8.2.4 byteable-0.1.1 bytestring-builder-0.10.8.2.0 cabal-doctest-1.0.8 call-stack-0.2.0 case-insensitive-1.2.1.0 cassava-0.5.2.0 cereal-0.5.8.1 cipher-aes-0.2.11 clientsession-0.9.1.2 clock-0.8 colour-2.3.5 comonad-5.0.6 conduit-1.3.2 conduit-extra-1.3.5 configurator-0.3.0.0 contravariant-1.5.2 cprng-aes-0.6.1 crypto-api-0.13.3 crypto-cipher-types-0.0.9 crypto-random-0.0.9 css-text-0.1.3.0 curl-1.3.8 data-default-0.7.1.1 data-default-class-0.1.2.0 data-default-instances-containers-0.0.1 data-default-instances-dlist-0.0.1 data-default-instances-old-locale-0.0.1 directory-1.3.6.1 directory-tree-0.12.1 distributive-0.6.2 dlist-0.8.0.8 easy-file-0.2.2 edit-distance-0.2.2.1 entropy-0.4.1.6 exceptions-0.10.4 extra-1.7.1 fast-logger-3.0.1 filelock-0.1.1.4 free-5.1.3 groom-0.1.2.1 hashable-1.3.0.0 haskell-lexer-1.1 haskell-src-exts-1.23.0 haskell-src-meta-0.8.5 heist-1.1.0.1 here-1.2.13 hostname-1.0 hspec-2.7.1 hspec-core-2.7.1 (hspec-discover-2.7.1) hspec-expectations-0.8.2 integer-logarithms-1.0.3 invariant-0.5.3 io-streams-1.5.1.0 io-streams-haproxy-1.0.1.0 kan-extensions-5.2 lens-4.19.2 lens-family-1.2.3 lens-family-core-1.2.3 lens-family-th-0.5.0.2 lens-simple-0.1.0.9 lifted-base-0.2.3.12 logging-3.0.5 logict-0.7.0.2 map-syntax-0.3 math-functions-0.3.3.0 memory-0.15.0 mime-mail-0.5.0 monad-control-1.0.2.3 monad-logger-0.3.32 monad-loops-0.4.3 mono-traversable-1.0.15.1 mwc-random-0.14.0.0 network-3.1.1.1 network-uri-2.6.3.0 old-locale-1.0.0.7 old-time-1.1.0.3 parallel-3.2.2.0 pretty-show-1.10 primitive-0.7.0.1 process-1.6.8.2 profunctors-5.5.2 quickcheck-io-0.2.0 random-1.1 random-shuffle-0.0.4 readable-0.3.1 reflection-2.1.5 regex-base-0.94.0.0 regex-compat-0.95.2.0 regex-posix-0.96.0.0 resourcet-1.2.3 safe-0.3.18 safe-exceptions-0.1.7.0 scientific-0.3.6.2 securemem-0.1.10 semigroupoids-5.3.4 semigroups-0.19.1 setenv-0.1.1.3 skein-1.0.9.4 snap-core-1.0.4.1 snap-server-1.1.1.1 split-0.2.3.4 splitmix-0.0.4 spoon-0.3.1 stm-chans-3.0.0.4 streaming-commons-0.2.1.2 strict-0.3.2 string-conversions-0.4.0.1 syb-0.7.1 tagged-0.8.6 tagsoup-0.14.8 text-short-0.1.3 tf-random-0.5 th-abstraction-0.3.2.0 th-expand-syns-0.4.6.0 th-lift-0.8.1 th-lift-instances-0.1.16 th-orphans-0.13.10 th-reify-many-0.1.9 time-1.10 time-compat-1.9.3 time-locale-compat-0.1.1.5 transformers-base-0.4.5.2 transformers-compat-0.6.5 typed-process-0.2.6.0 unix-compat-0.5.2 unix-time-0.4.7 unliftio-core-0.2.0.1 unordered-containers-0.2.10.0 utf8-string-1.0.1.1 uuid-types-1.0.3 value-supply-0.6 vector-0.12.1.2 vector-algorithms-0.8.0.3 vector-th-unbox-0.2.1.7 void-0.7.3 websockets-0.12.7.0 websockets-snap-0.10.3.1 xmlhtml-0.2.5.2 xss-sanitize-0.3.6 zlib-0.6.2.1 zlib-bindings-0.1.1.5

swamp-agr commented 4 years ago

When you launch ghci verbosely, you will see which packages will be chosen from global package database. In my case time (exporting UTCTime) was loaded, aeson (exporting ToJSON instances) was not loaded.

Prelude> :m + Data.Time
Prelude Data.Time> :i UTCTime
data UTCTime = UTCTime {utctDay :: Day, utctDayTime :: DiffTime}
    -- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Eq UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Ord UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Show UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.LocalTime.Internal.ZonedTime’
instance [safe] Read UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Format.Parse’
instance [safe] FormatTime UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Format.Format.Instances’
instance [safe] ParseTime UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Format.Parse.Instances’
Prelude Data.Time> :m + Data.Aeson
<no location info>: error:
    Could not find module ‘Data.Aeson’
    Perhaps you meant Data.Version (from base-4.13.0.0)
Prelude Data.Time> :set -package aeson
package flags [-package aeson{package aeson True ([])}]
loading package database $HOME/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d
cannot satisfy -package aeson

Checking package database:

ghc-pkg describe aeson
ghc-pkg: cannot find package aeson

Let see what differs when invoking v2- commands.

If you launch cabal v2-repl -v you will see that dist-newstyle directory would be created. Since v.2.0 cabal supports "nix-style" builds.

cabal v2-repl -v
this build was affected by the following (project) config files:
- $HOME/projects/fay/cabal.project
- $HOME/projects/fay/cabal.project.local
Build profile: -w ghc-8.8.3 -O1
In order, the following will be built:
 - fay-0.24.1.0 (first run)
creating $HOME/projects/fay/dist-newstyle/build
creating $HOME/projects/fay/dist-newstyle/tmp

It produces dist-newstyle directory.

creating
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0
creating
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/cache
whenReRegister: nothing to register
creating
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/setup
$HOME/.ghcup/bin/ghc --make -fbuilding-cabal-package -odir $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/setup -hidir $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/setup -i -i$HOME/projects/fay/. -optP-include -optP$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/setup/setup_macros.h -hide-all-packages -no-user-package-db -package-db $HOME/.cabal/store/ghc-8.8.3/package.db -package-db $HOME/projects/fay/dist-newstyle/packagedb/ghc-8.8.3 -package-id Cabal-3.0.1.0 -package-id base-4.13.0.0 $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/setup/setup.hs -o $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/setup/setup -threaded
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/setup/setup
repl --verbose=2
--builddir=$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0
lib:fay
$HOME/.ghcup/bin/ghc-pkg init $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/package.conf.inplace

It creates build plan, cache, local package database (!) and populates it according to the plan.

creating
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build
creating
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build/autogen
creating
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build/autogen
Preprocessing library for fay-0.24.1.0..
creating
$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build
$HOME/.ghcup/bin/ghc --interactive -fbuilding-cabal-package -O0 -outputdir $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build -odir $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build -hidir $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build -stubdir $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build -i -i$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build -isrc -isrc/haskell-names -i$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build/autogen -i$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build/global-autogen -I$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build/autogen -I$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build/global-autogen -I$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build -optP-include -optP$HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/build/autogen/cabal_macros.h -this-unit-id fay-0.24.1.0-inplace -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db $HOME/.cabal/store/ghc-8.8.3/package.db -package-db $HOME/projects/fay/dist-newstyle/packagedb/ghc-8.8.3 -package-db $HOME/projects/fay/dist-newstyle/build/x86_64-osx/ghc-8.8.3/fay-0.24.1.0/package.conf.inplace -package-id sn-1.4.7.1-2b5536a6 -package-id base-4.13.0.0 -package-id bs-cmpt-0.10.5-2f7269e4 -package-id bytestring-0.10.10.0 -package-id containers-0.6.2.1 -package-id dt-dflt-0.7.1.1-24b74cce -package-id dt-lns-lght-0.1.2.2-b1f6f357 -package-id directory-1.3.6.0 -package-id filepath-1.4.2.1 -package-id ghc-pths-0.1.0.12-47aa3fee -package-id hskll-src-xts-1.23.0-56dde871 -package-id lngg-cmscrpt-0.19.1.0-6f943873 -package-id mtl-2.2.2 -package-id mtl-cmpt-0.2.2-5ce678a6 -package-id process-1.6.8.0 -package-id sf-0.3.18-14e4ec52 -package-id shkspr-2.0.24-a6c05800 -package-id srcmp-0.1.6-4a3cebd2 -package-id splt-0.2.3.4-63d1c379 -package-id spn-0.3.1-4e977d3d -package-id syb-0.7.1-32d6b059 -package-id text-1.2.4.0 -package-id time-1.9.3 -package-id transformers-0.5.6.2 -package-id trnsfrmrs-cmpt-0.6.5-83d56f83 -package-id trvrs-wth-clss-1.0.1.0-3f3622ee -package-id nplt-1.6.12-057b3551 -package-id nrdrd-cntnrs-0.2.10.0-23962be8 -package-id tf8-strng-1.0.1.1-f0972d8a -package-id vctr-0.12.1.2-be5d6a11 -XHaskell98 Fay Fay.Compiler Fay.Compiler.Desugar Fay.Compiler.Parse Fay.Compiler.Prelude Fay.Config Fay.Convert Fay.FFI Fay.Types Fay.Types.CompileError Fay.Types.CompileResult Fay.Compiler.Decl Fay.Compiler.Defaults Fay.Compiler.Desugar.Name Fay.Compiler.Desugar.Types Fay.Compiler.Exp Fay.Compiler.FFI Fay.Compiler.GADT Fay.Compiler.Import Fay.Compiler.InitialPass Fay.Compiler.Misc Fay.Compiler.ModuleT Fay.Compiler.Optimizer Fay.Compiler.Packages Fay.Compiler.Pattern Fay.Compiler.PrimOp Fay.Compiler.Print Fay.Compiler.QName Fay.Compiler.State Fay.Compiler.Typecheck Fay.Exts Fay.Exts.NoAnnotation Fay.Exts.Scoped Fay.Runtime Fay.Types.FFI Fay.Types.Js Fay.Types.ModulePath Fay.Types.Printer Language.Haskell.Names Language.Haskell.Names.Annotated Language.Haskell.Names.Exports Language.Haskell.Names.GetBound Language.Haskell.Names.GlobalSymbolTable Language.Haskell.Names.Imports Language.Haskell.Names.LocalSymbolTable Language.Haskell.Names.ModuleSymbols Language.Haskell.Names.Open.Base Language.Haskell.Names.Open.Derived Language.Haskell.Names.Open.Instances Language.Haskell.Names.RecordWildcards Language.Haskell.Names.Recursive Language.Haskell.Names.ScopeUtils Language.Haskell.Names.SyntaxUtils Language.Haskell.Names.Types Paths_fay -Wall -hide-all-packages
GHCi, version 8.8.3: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from $HOME/.ghci

And finally it:

...
Ok, 56 modules loaded.
*Fay> :i UTCTime

<interactive>:1:1: error: Not in scope: ‘UTCTime’
*Fay> :m + Data.Time Data.Aeson
*Fay Data.Time Data.Aeson> :i UTCTime
data UTCTime = UTCTime {utctDay :: Day, utctDayTime :: DiffTime}
    -- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Eq UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Ord UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Show UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.LocalTime.Internal.ZonedTime’
instance [safe] Data UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Read UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Format.Parse’
instance [safe] FormatTime UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Format.Format.Instances’
instance [safe] ParseTime UTCTime
  -- Defined in ‘time-1.9.3:Data.Time.Format.Parse.Instances’
instance ToJSON UTCTime
  -- Defined in ‘aeson-1.4.7.1:Data.Aeson.Types.ToJSON’
instance ToJSONKey UTCTime
  -- Defined in ‘aeson-1.4.7.1:Data.Aeson.Types.ToJSON’
instance FromJSON UTCTime
  -- Defined in ‘aeson-1.4.7.1:Data.Aeson.Types.FromJSON’
instance FromJSONKey UTCTime
  -- Defined in ‘aeson-1.4.7.1:Data.Aeson.Types.FromJSON’

The magic is inside of cabal and its dist-newstyle machinery!

henrylaxen commented 4 years ago

Thanks so much Andrey for tracking this down. I have a better understanding of ghci vs cabal now.

Best wishes, Henry Laxen -- Nadine and Henry Laxen The rest is silence Gral. Manuel Márquez de León 1301 Onix #2302 Zona Urban Rio Never try to teach a pig to sing Tijuana It wastes your time
+52 (333) 667-8633 And it annoys the pig

swamp-agr commented 4 years ago

Henry,

Question seems to be resolved. If you have more questions feel free to reopen it or create a new one.

Best Regards, @swamp-agr