Commit 948c82d8 authored by dterei's avatar dterei
Browse files

More THREAD fixes to safe haskell tests

parent f4ce3b24
...@@ -17,7 +17,7 @@ newMinList n = MinList n [] ...@@ -17,7 +17,7 @@ newMinList n = MinList n []
insertMinList :: Ord a => MinList a -> a -> MinList a insertMinList :: Ord a => MinList a -> a -> MinList a
insertMinList s@(MinList m xs) n | n > m = MinList m (n:xs) insertMinList s@(MinList m xs) n | n > m = MinList m (n:xs)
| otherwise = s | otherwise = s
printIntMinList :: MinList Int -> IO () printIntMinList :: MinList Int -> IO ()
printIntMinList (MinList min xs) = putStrLn $ "MinList Int :: MinList " ++ show min ++ " " ++ show xs printIntMinList (MinList min xs) = putStrLn $ "MinList Int :: MinList " ++ show min ++ " " ++ show xs
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
-- API of Y1. -- API of Y1.
module Main where module Main where
import SafeLang06_A import SafeLang07_A
class IntIso t where class IntIso t where
intIso :: c t -> c Int intIso :: c t -> c Int
...@@ -39,4 +39,3 @@ main = do ...@@ -39,4 +39,3 @@ main = do
printIntMinList a1 printIntMinList a1
printIntMinList a2 printIntMinList a2
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
<no location info>: <no location info>:
Warning: -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving Warning: -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
SafeLang07.hs:23:45: SafeLang07.hs:15:1:
Can't make a derived instance of `IntIso (Down a)': Failed to load interface for `SafeLang07_A'
`IntIso' is not a derivable class Use -v to see a list of the files searched for.
Try -XGeneralizedNewtypeDeriving for GHC's newtype-deriving extension
In the newtype declaration for `Down'
{-# LANGUAGE Trustworthy #-}
-- | Here we expose a MinList API that only allows elements
-- to be inserted into a list if they are at least greater
-- than an initial element the list is created with.
module SafeLang07_A (
MinList,
newMinList,
insertMinList,
printIntMinList
) where
data MinList a = MinList a [a]
newMinList :: Ord a => a -> MinList a
newMinList n = MinList n []
insertMinList :: Ord a => MinList a -> a -> MinList a
insertMinList s@(MinList m xs) n | n > m = MinList m (n:xs)
| otherwise = s
printIntMinList :: MinList Int -> IO ()
printIntMinList (MinList min xs) = putStrLn $ "MinList Int :: MinList " ++ show min ++ " " ++ show xs
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