Skip to content

Instantly share code, notes, and snippets.

@nushio3
Last active August 29, 2015 14:22
Show Gist options
  • Save nushio3/4b6ac221d46bb52a101c to your computer and use it in GitHub Desktop.
Save nushio3/4b6ac221d46bb52a101c to your computer and use it in GitHub Desktop.
uom-plugin lesson
{-# OPTIONS_GHC -fplugin Data.UnitsOfMeasure.Plugin #-}
{-# LANGUAGE DataKinds, QuasiQuotes, TypeOperators #-}
{-# LANGUAGE TypeFamilies, UndecidableInstances #-}
import Data.UnitsOfMeasure
main :: IO ()
main = print ([u| 3 m |] :: Quantity Int [u| m |])
{-
(7.10.1)nushio@nuwheezy:uom-plugin$ ghc learn.hs
[1 of 1] Compiling Main ( learn.hs, learn.o )
learn.hs:8:8:
No instance for (Data.UnitsOfMeasure.Singleton.KnownUnit
(Unpack (MkUnit "m")))
arising from a use of ‘print’
In the expression:
print
((Data.UnitsOfMeasure.Internal.MkQuantity ::
forall a_a4cE. a_a4cE -> Quantity a_a4cE (MkUnit "m")
3) ::
Quantity Int (MkUnit "m"))
In an equation for ‘main’:
main
= print
((Data.UnitsOfMeasure.Internal.MkQuantity ::
forall a_a4cE. a_a4cE -> Quantity a_a4cE (MkUnit "m")
3) ::
Quantity Int (MkUnit "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