|
1 |
| -{-# LANGUAGE ExplicitForAll, StandaloneDeriving, DuplicateRecordFields, ScopedTypeVariables, InstanceSigs, KindSignatures, GADTs, FlexibleContexts, RankNTypes, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, AllowAmbiguousTypes, TypeOperators |
2 |
| -,LiberalTypeSynonyms, ImpredicativeTypes, UndecidableInstances, FunctionalDependencies #-} |
| 1 | +{-# LANGUAGE AllowAmbiguousTypes #-} |
| 2 | +{-# LANGUAGE DataKinds #-} |
| 3 | +{-# LANGUAGE DuplicateRecordFields #-} |
| 4 | +{-# LANGUAGE ExplicitForAll #-} |
| 5 | +{-# LANGUAGE FlexibleContexts #-} |
| 6 | +{-# LANGUAGE FlexibleInstances #-} |
| 7 | +{-# LANGUAGE FunctionalDependencies #-} |
| 8 | +{-# LANGUAGE GADTs #-} |
| 9 | +{-# LANGUAGE ImpredicativeTypes #-} |
| 10 | +{-# LANGUAGE InstanceSigs #-} |
| 11 | +{-# LANGUAGE LiberalTypeSynonyms #-} |
| 12 | +{-# LANGUAGE MultiParamTypeClasses #-} |
| 13 | +{-# LANGUAGE RankNTypes #-} |
| 14 | +{-# LANGUAGE ScopedTypeVariables #-} |
| 15 | +{-# LANGUAGE TypeOperators #-} |
| 16 | +{-# LANGUAGE TypeSynonymInstances #-} |
| 17 | +{-# LANGUAGE UndecidableInstances #-} |
3 | 18 |
|
4 | 19 | module Language.AQL where
|
5 | 20 |
|
6 |
| -import Prelude hiding (EQ) |
7 |
| -import qualified Data.Map.Strict as Map |
8 |
| -import Language.Graph |
9 |
| -import Language.Common as C |
10 |
| -import Language.Term as Term |
11 |
| -import Language.Schema as S |
12 |
| -import Language.Instance as I |
13 |
| -import Language.Mapping as M |
14 |
| -import Language.Typeside as T |
15 |
| -import Language.Transform as Tr |
16 |
| -import Language.Query as Q |
17 |
| -import Data.List (nub) |
18 |
| -import Data.Maybe |
19 |
| -import Language.Parser (parseAqlProgram) |
20 |
| -import Language.Program as P |
21 |
| -import Data.Typeable |
22 |
| -import Language.Options |
23 |
| -import System.Timeout |
24 |
| -import System.IO.Unsafe |
25 |
| -import Control.DeepSeq |
26 |
| -import Control.Concurrent |
27 |
| -import Control.Exception |
| 21 | +import Control.Concurrent |
| 22 | +import Control.DeepSeq |
| 23 | +import Control.Exception |
| 24 | +import Data.List (nub) |
| 25 | +import qualified Data.Map.Strict as Map |
| 26 | +import Data.Maybe |
| 27 | +import Data.Typeable |
| 28 | +import Language.Common as C |
| 29 | +import Language.Graph |
| 30 | +import Language.Instance as I |
| 31 | +import Language.Mapping as M |
| 32 | +import Language.Options |
| 33 | +import Language.Parser (parseAqlProgram) |
| 34 | +import Language.Program as P |
| 35 | +import Language.Query as Q |
| 36 | +import Language.Schema as S |
| 37 | +import Language.Term as Term |
| 38 | +import Language.Transform as Tr |
| 39 | +import Language.Typeside as T |
| 40 | +import Prelude hiding (EQ) |
| 41 | +import System.IO.Unsafe |
| 42 | +import System.Timeout |
28 | 43 |
|
29 | 44 | -- works
|
30 | 45 | timeout' :: (Show x, NFData x) => Integer -> Err x -> Err x
|
@@ -262,7 +277,7 @@ getKindCtx g v k = case k of
|
262 | 277 | MAPPING -> fmap ExpM $ n $ Map.lookup v $ mappings g
|
263 | 278 | TRANSFORM -> fmap ExpT $ n $ Map.lookup v $ transforms g
|
264 | 279 | QUERY -> fmap ExpQ $ n $ Map.lookup v $ queries g
|
265 |
| - _ -> error "todo" |
| 280 | + _ -> error "todo" |
266 | 281 | where
|
267 | 282 | n :: forall x. Maybe x -> Err x
|
268 | 283 | n x = note ("Undefined " ++ show k ++ ": " ++ v) x
|
@@ -322,19 +337,18 @@ evalTypeside p e (TypesideRaw r) = do
|
322 | 337 | x <- mapM (evalTypeside p e) $ tsraw_imports r
|
323 | 338 | evalTypesideRaw (other e) r x
|
324 | 339 | evalTypeside _ env (TypesideVar v) = case Map.lookup v $ typesides env of
|
325 |
| - Nothing -> Left $ "Undefined typeside: " ++ show v |
| 340 | + Nothing -> Left $ "Undefined typeside: " ++ show v |
326 | 341 | Just (TypesideEx e) -> Right $ TypesideEx e
|
327 | 342 | evalTypeside _ _ TypesideInitial = pure $ TypesideEx $ initialTypeside
|
328 | 343 |
|
329 |
| -convSchema :: (Typeable var1, Typeable ty1, Typeable sym1, Typeable en1, Typeable fk1, Typeable att1, |
330 |
| - Typeable var, Typeable ty, Typeable sym, Typeable en, Typeable fk, Typeable att) |
331 |
| - => Schema var1 ty1 sym1 en1 fk1 att1 -> Schema var ty sym en fk att |
| 344 | +convSchema |
| 345 | + :: TyMap Typeable '[var1, ty1, sym1, en1, fk1, att1, var, ty, sym, en, fk, att] |
| 346 | + => Schema var1 ty1 sym1 en1 fk1 att1 -> Schema var ty sym en fk att |
332 | 347 | convSchema x = fromJust $ cast x
|
333 | 348 |
|
334 |
| -convInstance :: (Typeable var1, Typeable ty1, Typeable sym1, Typeable en1, Typeable fk1, Typeable att1, |
335 |
| - Typeable var, Typeable ty, Typeable sym, Typeable en, Typeable fk, Typeable att, |
336 |
| - Typeable gen, Typeable gen', Typeable sk, Typeable sk', Typeable x, Typeable x', Typeable y, Typeable y') |
337 |
| - => Instance var1 ty1 sym1 en1 fk1 att1 gen' sk' x' y' -> Instance var ty sym en fk att gen sk x y |
| 349 | +convInstance |
| 350 | + :: TyMap Typeable '[var1, ty1, sym1, en1, fk1, att1, var, ty, sym, en, fk, att, gen, gen', sk, sk', x, x', y, y'] |
| 351 | + => Instance var1 ty1 sym1 en1 fk1 att1 gen' sk' x' y' -> Instance var ty sym en fk att gen sk x y |
338 | 352 | convInstance x = fromJust $ cast x
|
339 | 353 |
|
340 | 354 | evalTransform :: Prog -> Env -> TransformExp -> Err TransformEx
|
|
0 commit comments