@@ -22,8 +22,8 @@ TT is the core language of Idris. The language has:
22 * We have a simple collection of tactics which we use to elaborate source
22 * We have a simple collection of tactics which we use to elaborate source
23 programs with implicit syntax into fully explicit terms.
23 programs with implicit syntax into fully explicit terms.
25−{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, DeriveFunctor,
25+{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, DeriveGeneric,
26− DeriveDataTypeable, DeriveGeneric, PatternGuards #-}
26+ FunctionalDependencies, MultiParamTypeClasses, PatternGuards #-}
27{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
27{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
28module Idris.Core.TT(
28module Idris.Core.TT(
29 AppStatus(..), ArithTy(..), Binder(..), Const(..), Ctxt(..)
29 AppStatus(..), ArithTy(..), Binder(..), Const(..), Ctxt(..)
@@ -51,40 +51,39 @@ module Idris.Core.TT(
51 , uniqueNameFrom, uniqueNameSet, unList, updateDef, vToP, weakenTm
51 , uniqueNameFrom, uniqueNameSet, unList, updateDef, vToP, weakenTm
54+import Util.Pretty hiding (Str)
54-- Work around AMP without CPP
56-- Work around AMP without CPP
55−import Prelude (Eq(..), Show(..), Ord(..), Functor(..), Monad(..), String, Int,
57+import Prelude (Bool(..), Double, Enum(..), Eq(..), FilePath, Functor(..), Int,
56− Integer, Ordering(..), Maybe(..), Num(..), Bool(..), Enum(..),
58+ Integer, Maybe(..), Monad(..), Num(..), Ord(..), Ordering(..),
57− Read(..), FilePath, Double, (&&), (||), ($), (.), div, error, flip,
59+ Read(..), Show(..), String, div, error, flip, fst, mod, not,
58− fst, snd, not, mod, read, otherwise)
60+ otherwise, read, snd, ($), (&&), (.), (||))
60−import Control.Applicative (Applicative (..), Alternative)
62+import Control.Applicative (Alternative, Applicative(..))
61−import qualified Control.Applicative as A (Alternative (..))
63+import qualified Control.Applicative as A (Alternative(..))
62import Control.DeepSeq (($!!))
64import Control.DeepSeq (($!!))
63import Control.Monad.State.Strict
65import Control.Monad.State.Strict
64−import Control.Monad.Trans.Except (Except (..))
66+import Control.Monad.Trans.Except (Except(..))
65−import Debug.Trace
67+import Data.Binary hiding (get, put)
66−import qualified Data.Map.Strict as Map
68+import qualified Data.Binary as B
67import Data.Char
69import Data.Char
68import Data.Data (Data)
70import Data.Data (Data)
69−import Data.Monoid (mconcat)
71+import Data.Foldable (Foldable)
70−import Numeric (showIntAtBase)
71−import qualified Data.Text as T
72import Data.List hiding (group, insert)
72import Data.List hiding (group, insert)
73−import Data.Set(Set, member, fromList, insert)
73+import qualified Data.Map.Strict as Map
74import Data.Maybe (listToMaybe)
74import Data.Maybe (listToMaybe)
75−import Data.Foldable (Foldable)
75+import Data.Monoid (mconcat)
76+import Data.Set (Set, fromList, insert, member)
77+import qualified Data.Text as T
76import Data.Traversable (Traversable)
78import Data.Traversable (Traversable)
77import Data.Typeable (Typeable)
79import Data.Typeable (Typeable)
78import Data.Vector.Unboxed (Vector)
80import Data.Vector.Unboxed (Vector)
79import qualified Data.Vector.Unboxed as V
81import qualified Data.Vector.Unboxed as V
80−import qualified Data.Binary as B
82+import Debug.Trace
81−import Data.Binary hiding (get, put)
82import Foreign.Storable (sizeOf)
83import Foreign.Storable (sizeOf)
83import GHC.Generics (Generic)
84import GHC.Generics (Generic)
84−
85+import Numeric (showIntAtBase)
85−import Numeric.IEEE (IEEE (identicalIEEE))
86+import Numeric.IEEE (IEEE(identicalIEEE))
87−import Util.Pretty hiding (Str)
89data Option = TTypeInTType
88data Option = TTypeInTType
90 | CheckConv
89 | CheckConv
@@ -941,7 +940,7 @@ instance Sized UExp where
941 size _ = 1
940 size _ = 1
943instance Show UExp where
942instance Show UExp where
944− show (UVar ns x)
943+ show (UVar ns x)
945 | x < 26 = ns ++ "." ++ [toEnum (x + fromEnum 'a')]
944 | x < 26 = ns ++ "." ++ [toEnum (x + fromEnum 'a')]
946 | otherwise = ns ++ "." ++ toEnum ((x `mod` 26) + fromEnum 'a') : show (x `div` 26)
945 | otherwise = ns ++ "." ++ toEnum ((x `mod` 26) + fromEnum 'a') : show (x `div` 26)
947 show (UVal x) = show x
946 show (UVal x) = show x
@@ -1289,7 +1288,7 @@ substTerm old new = st where
1289 st (Bind x b sc) = Bind x (fmap st b) (st sc)
1288 st (Bind x b sc) = Bind x (fmap st b) (st sc)
1290 st t = t
1289 st t = t
1292− eqAlpha as (P _ x _) (P _ y _)
1291+ eqAlpha as (P _ x _) (P _ y _)
1293 = x == y || (x, y) `elem` as || (y, x) `elem` as
1292 = x == y || (x, y) `elem` as || (y, x) `elem` as
1294 eqAlpha as (V x) (V y) = x == y
1293 eqAlpha as (V x) (V y) = x == y
1295 eqAlpha as (Bind x xb xs) (Bind y yb ys)
1294 eqAlpha as (Bind x xb xs) (Bind y yb ys)
@@ -1301,7 +1300,7 @@ substTerm old new = st where
1301 = eqAlpha as xt yt && eqAlpha as xv yv
1300 = eqAlpha as xt yt && eqAlpha as xv yv
1302 eqAlphaB as (Guess xt xv) (Guess yt yv)
1301 eqAlphaB as (Guess xt xv) (Guess yt yv)
1303 = eqAlpha as xt yt && eqAlpha as xv yv
1302 = eqAlpha as xt yt && eqAlpha as xv yv
1304− eqAlphaB as bx by = eqAlpha as (binderTy bx) (binderTy by)
1303+ eqAlphaB as bx by = eqAlpha as (binderTy bx) (binderTy by)
1306-- | Return number of occurrences of V 0 or bound name i the term
1305-- | Return number of occurrences of V 0 or bound name i the term
1307occurrences :: Eq n => n -> TT n -> Int
1306occurrences :: Eq n => n -> TT n -> Int