Skip to content

Commit

Permalink
Type synonyms with quasiquotes or symbols outside refinements, #49.
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Jun 30, 2018
1 parent 48287f3 commit 99d3522
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions uom-plugin/liquid/Liquid.hs
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
{-# LANGUAGE DataKinds#-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE QuasiQuotes #-}

{-# OPTIONS_GHC -fplugin Data.UnitsOfMeasure.Plugin #-}

module Main (main) where
module Main (main, AB(..), Qs, Qm) where

import Language.Haskell.Liquid.Liquid (liquid)
import Data.UnitsOfMeasure
import Data.UnitsOfMeasure (Quantity, u)
import Data.UnitsOfMeasure.Defs ()

{-@ type Qs = Quantity Double [u| s |] @-}

-- NOTE: I cannot use quasiquotes or symbols with liquid haskell.
type Qs = Quantity Double [u| s |]
type Qm = Quantity Double [u| m |]

data AB
= A { x :: Quantity Double [u| s |] }
| B { y :: Quantity Double [u| m |] }

{-@ data A = A {x :: Qs} | B {y :: Qm} @-}

minute :: Qs
minute :: Quantity Double [u| s |]
minute = [u| 60 s |]

main :: IO a
Expand Down

0 comments on commit 99d3522

Please sign in to comment.