Created
June 5, 2015 13:46
-
-
Save nushio3/0d01c4672982ceaf7e2f to your computer and use it in GitHub Desktop.
Working Example on uom-plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -fplugin Data.UnitsOfMeasure.Plugin #-} | |
{-# LANGUAGE DataKinds, QuasiQuotes, TypeOperators #-} | |
{-# LANGUAGE TypeFamilies, UndecidableInstances #-} | |
import Data.UnitsOfMeasure | |
[u| m |] | |
main :: IO () | |
main = print ([u| 3 m |] :: Quantity Int [u| m |]) | |
{- | |
(7.10.1)nushio@nuwheezy:uom-plugin$ ghc learn.hs -ddump-splices | |
[1 of 1] Compiling Main ( learn.hs, learn.o ) | |
learn.hs:1:1: Splicing declarations | |
" m " ======> [type instance MkUnit "m" = Base "m"] | |
learn.hs:12:43-50: Splicing type | |
" m " ======> MkUnit "m" | |
learn.hs:12:15-25: Splicing expression | |
" 3 m " | |
======> | |
Data.UnitsOfMeasure.Internal.MkQuantity :: | |
forall a_a4dX. a_a4dX -> Quantity a_a4dX (MkUnit "m") | |
3 | |
Linking learn ... | |
(7.10.1)nushio@nuwheezy:uom-plugin$ ./learn | |
[u| 3 m |] | |
(7.10.1)nushio@nuwheezy:uom-plugin$ | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment