Skip to content

Instantly share code, notes, and snippets.

@kuribas
Last active January 17, 2020 12:14
Show Gist options
  • Save kuribas/912a0ae651dea30828e295ce2d82b14f to your computer and use it in GitHub Desktop.
Save kuribas/912a0ae651dea30828e295ce2d82b14f to your computer and use it in GitHub Desktop.
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE DataKinds #-}
module Test where
import Data.TypeRepMap
data Currency = USD | EUR | JPY
-- | A typesafe money datatype, indexed by currency
newtype Money (a :: Currency) = Money Int
-- | A datatype to hide the currency information, using existential quantification
data SomeMoney = forall (a :: Currency) . SomeMoney {getMoney :: Money a }
-- | Create a map which is indexed by the currency value
addMoneys :: [SomeMoney] -> TypeRepMap Money
addMoneys = foldl (\mp money -> insert (getMoney money) mp) empty
@kuribas
Copy link
Author

kuribas commented Jan 17, 2020

Glasgow Haskell Compiler, Version 8.4.4, stage 2 booted by GHC version 8.2.2
Using binary package database: /opt/ghc/8.4.4/lib/ghc-8.4.4/package.conf.d/package.cache
Using binary package database: /home/kristof/.ghc/x86_64-linux-8.4.4/package.conf.d/package.cache
package flags []
loading package database /opt/ghc/8.4.4/lib/ghc-8.4.4/package.conf.d
loading package database /home/kristof/.ghc/x86_64-linux-8.4.4/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.2.0
wired-in package integer-gmp mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.11.1.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.13.0.0
wired-in package ghc mapped to ghc-8.4.4
wired-in package dph-seq not found.
wired-in package dph-par not found.
package flags []
loading package database /opt/ghc/8.4.4/lib/ghc-8.4.4/package.conf.d
loading package database /home/kristof/.ghc/x86_64-linux-8.4.4/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.2.0
wired-in package integer-gmp mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.11.1.0
wired-in package rts mapped to rts-1.0
wired-in package template-haskell mapped to template-haskell-2.13.0.0
wired-in package ghc mapped to ghc-8.4.4
wired-in package dph-seq not found.
wired-in package dph-par not found.
*** Chasing dependencies:
Chasing modules from: *Test2.hs
!!! Chasing dependencies: finished in 0.82 milliseconds, allocated 0.858 megabytes
Stable obj: []
Stable BCO: []
Ready for upsweep
[NONREC
ModSummary {
ms_hs_date = 2020-01-17 11:06:36.022761183 UTC
ms_mod = Test,
ms_textual_imps = [(Nothing, Prelude), (Nothing, Data.TypeRepMap)]
ms_srcimps = []
}]
*** Deleting temp files:
Deleting:
compile: input file Test2.hs
*** Checking old interface for Test (use -ddump-hi-diffs for more details):
*** Parser [Test]:
!!! Parser [Test]: finished in 0.36 milliseconds, allocated 0.519 megabytes
*** Renamer/typechecker [Test]:
!!! Renamer/typechecker [Test]: finished in 6.57 milliseconds, allocated 3.810 megabytes

Test2.hs:4:1: error:
Could not find module ‘Data.TypeRepMap’
Locations searched:
Data/TypeRepMap.hs
Data/TypeRepMap.lhs
Data/TypeRepMap.hsig
Data/TypeRepMap.lhsig
|
4 | import Data.TypeRepMap
| ^^^^^^^^^^^^^^^^^^^^^^
Upsweep partially successful.
*** Deleting temp files:
Deleting:
link(batch): upsweep (partially) failed OR
Main.main not exported; not linking.
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment