Commit 1e18f31b authored by Andrew Gibiansky's avatar Andrew Gibiansky

Fixing formatting issues, again

parent 6df3ee72
...@@ -339,35 +339,38 @@ evaluate kernelState code output = do ...@@ -339,35 +339,38 @@ evaluate kernelState code output = do
storeItCommand execCount = Statement $ printf "let it%d = it" execCount storeItCommand execCount = Statement $ printf "let it%d = it" execCount
extractValue :: forall a. Typeable a => String -> Interpreter a extractValue :: Typeable a => String -> Interpreter a
extractValue expr = do extractValue expr = do
compiled <- dynCompileExpr expr compiled <- dynCompileExpr expr
case fromDynamic compiled of case fromDynamic compiled of
Nothing -> Nothing -> error "Error casting types in Evaluate.hs"
let expectedTypeRep = typeOf (undefined :: a)
actualTypeRep = dynTypeRep compiled
TypeRep fing1 tycon1 subs1 = expectedTypeRep
TypeRep fing2 tycon2 subs2 = actualTypeRep
in error $ concat
[ "Expecting value of type "
, showTypeRep expectedTypeRep
, " but got value of type "
, showTypeRep actualTypeRep
]
Just result -> return result Just result -> return result
showTypeRep :: TypeRep -> String showTypeRep :: TypeRep -> String
showTypeRep (TypeRep fingerprint tycon subs) = showTypeRep (TypeRep fingerprint tycon subs) =
concat ["TypeRep " concat
, show fingerprint [ "TypeRep "
, " " , show fingerprint
, show (tyConPackage tycon, tyConModule tycon, tyConName tycon, tyConHash tycon) , " "
, " " , show (tyConPackage tycon, tyConModule tycon, tyConName tycon, tyConHash tycon)
, "[" , " "
, intercalate ", " (map showTypeRep subs) , "["
, "]" , intercalate ", " (map showTypeRep subs)
] , "]"
]
{-
let expectedTypeRep = typeOf (undefined :: a)
actualTypeRep = dynTypeRep compiled
TypeRep fing1 tycon1 subs1 = expectedTypeRep
TypeRep fing2 tycon2 subs2 = actualTypeRep
in error $ concat
[ "Expecting value of type "
, showTypeRep expectedTypeRep
, " but got value of type "
, showTypeRep actualTypeRep
]
-}
safely :: KernelState -> Interpreter EvalOut -> Interpreter EvalOut safely :: KernelState -> Interpreter EvalOut -> Interpreter EvalOut
safely state = ghandle handler . ghandle sourceErrorHandler safely state = ghandle handler . ghandle sourceErrorHandler
where where
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment