ian-ross / hnetcdf

Haskell NetCDF library
BSD 3-Clause "New" or "Revised" License
11 stars 9 forks source link

example3.hs cmap error #2

Closed jimstutt closed 10 years ago

jimstutt commented 10 years ago

Hi,

I failed to find dist/..autogen/Paths_hnetcdf.hs trying to build the latest github clone hnetcdf in a sandbox. I haven't yet grokked the subtletes of cabal sandbox add-source with cabal build so I just cabal installed it from hackage.

Trying the new example3.hs:

src/zC20-3.hs:61:16: No instance for (Element CDouble) arising from a use of ‘cmap’ In the expression: cmap ((/ 9.8) . realToFrac) slice1tmp2 :: Matrix Double In an equation for ‘slice1’: slice1 = cmap ((/ 9.8) . realToFrac) slice1tmp2 :: Matrix Double In the expression: do { Right nc <- openFile "../data/X92.19.55.235.191.8.30.38.nc"; putStrLn $ "Name: " ++ ncName nc; putStrLn $ "Dims: " ++ show (M.keys $ ncDims nc); putStr $ unlines $ map (\ (n, s) -> " " ++ n ++ ": " ++ s) $ M.toList $ flip M.map (ncDims nc) $ \ d -> show (ncDimLength d) ++ if ncDimUnlimited d then " (UNLIM)" else ""; .... }

ian-ross commented 10 years ago

Ha. I hadn't set the examples up for building. I had been doing something like cabal --sandbox-config-file=../cabal.sandbox.config exec ghc -- --make example3.hs to build them, which picks up the version of hnetcdf installed in the sandbox. I've not really got comfortable with using add-source yet either. Anyway, I'll add the examples to the Cabal file as executables so they'll get built along with the library.

ian-ross commented 10 years ago

I think that https://github.com/ian-ross/hnetcdf/commit/a5791dd7bcce7812bcea60e06a28870121de602c fixes this, at least to some extent.