Skip to content

Commit

Permalink
Safe/Trustworthy Haskell tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
leepike committed Mar 2, 2012
1 parent fa524f2 commit fe084bb
Show file tree
Hide file tree
Showing 22 changed files with 61 additions and 23 deletions.
6 changes: 4 additions & 2 deletions src/Copilot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | Main import module for the front-end lanugage.

{-# LANGUAGE Safe #-}

module Copilot
( module Copilot.Language
) where

import Copilot.Language

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
2 changes: 2 additions & 0 deletions src/Copilot/Language.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

-- | Main Copilot language export file.

{-# LANGUAGE Safe #-}

module Copilot.Language
( module Data.Int
, module Data.Word
Expand Down
5 changes: 3 additions & 2 deletions src/Copilot/Language/Analyze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

{-# LANGUAGE Safe #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand All @@ -23,8 +24,8 @@ import Data.List (groupBy)
import Data.IORef
import Data.Typeable
import System.Mem.StableName.Dynamic
import System.Mem.StableName.Dynamic.Map (Map(..))
import qualified System.Mem.StableName.Dynamic.Map as M
import System.Mem.StableName.Map (Map(..))
import qualified System.Mem.StableName.Map as M
import Control.Monad (when, foldM_, foldM)
import Control.Exception (Exception, throw)

Expand Down
2 changes: 2 additions & 0 deletions src/Copilot/Language/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

{-# LANGUAGE Safe #-}

module Copilot.Language.Error
( impossible
, badUsage ) where
Expand Down
5 changes: 3 additions & 2 deletions src/Copilot/Language/Interpret.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{- Copyright (c) 2011 National Institute of Aerospace / Galois, Inc. -}

{-# LANGUAGE GADTs, FlexibleInstances #-}

-- | The interpreter.

{-# LANGUAGE Safe #-}
{-# LANGUAGE GADTs, FlexibleInstances #-}

module Copilot.Language.Interpret
( --Input
csv
Expand Down
3 changes: 3 additions & 0 deletions src/Copilot/Language/Operators/BitWise.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- | Bitwise operators.

{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

module Copilot.Language.Operators.BitWise
Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Language/Operators/Boolean.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | Boolean operators.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Boolean
( (&&)
Expand Down
5 changes: 3 additions & 2 deletions src/Copilot/Language/Operators/Cast.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

{-# LANGUAGE MultiParamTypeClasses #-}

-- | Type-safe casting operators.

{-# LANGUAGE Safe #-}
{-# LANGUAGE MultiParamTypeClasses #-}

module Copilot.Language.Operators.Cast
( cast ) where

Expand Down
2 changes: 2 additions & 0 deletions src/Copilot/Language/Operators/Constant.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

-- | Constants.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Constant
( constant
, constB
Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Language/Operators/Eq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | Equality operator.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Eq
( (==)
Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Language/Operators/Extern.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | External variables, arrays, and functions.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Extern
( extern
Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Language/Operators/Integral.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | Integral class operators.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Integral
( div
Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Language/Operators/Local.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | Let expressions.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Local
( local
Expand Down
2 changes: 2 additions & 0 deletions src/Copilot/Language/Operators/Mux.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

-- | if-then-else.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Mux
( mux
, ifThenElse
Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Language/Operators/Ord.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | Comparison operators.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Ord
( (<=)
Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Language/Operators/Temporal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- |
-- | Stream construction.

{-# LANGUAGE Safe #-}

module Copilot.Language.Operators.Temporal
( (++)
Expand Down
2 changes: 2 additions & 0 deletions src/Copilot/Language/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
-- | Reexports 'Prelude' from package "base" hiding identifiers redefined by
-- Copilot.

{-# LANGUAGE Safe #-}

module Copilot.Language.Prelude
( module Prelude
) where
Expand Down
7 changes: 4 additions & 3 deletions src/Copilot/Language/Reify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
-- | Transforms a Copilot Language specification into a Copilot Core
-- specification.

{-# LANGUAGE Safe #-}
{-# LANGUAGE ExistentialQuantification, Rank2Types #-}

module Copilot.Language.Reify
( reify
) where

import qualified Copilot.Core as Core
import Copilot.Core (Typed, Type, Id, typeOf, impossible)
import Copilot.Core (Typed, Id, typeOf, impossible)

--import Copilot.Language.Reify.Sharing (makeSharingExplicit)
import Copilot.Language.Analyze (analyze)
Expand All @@ -22,8 +23,8 @@ import Copilot.Language.Stream (Stream (..), Arg (..))
import Prelude hiding (id)
import Data.IORef
import System.Mem.StableName.Dynamic
import System.Mem.StableName.Dynamic.Map (Map)
import qualified System.Mem.StableName.Dynamic.Map as M
import System.Mem.StableName.Map (Map)
import qualified System.Mem.StableName.Map as M
import Control.Monad (liftM)

--------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/Copilot/Language/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

-- | Copilot specifications.

{-# LANGUAGE Safe #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}

-- |

module Copilot.Language.Spec
( Spec
, runSpec
Expand Down
1 change: 1 addition & 0 deletions src/Copilot/Language/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

-- | Abstract syntax for streams and operators.

{-# LANGUAGE Safe #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE Rank2Types #-}
Expand Down
4 changes: 3 additions & 1 deletion src/System/Mem/StableName/Dynamic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
--------------------------------------------------------------------------------

{-# LANGUAGE Trustworthy #-}

module System.Mem.StableName.Dynamic
( DynStableName(..)
, hashDynStableName
, makeDynStableName
) where

import System.Mem.StableName (StableName, makeStableName, hashStableName)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce) -- XXX Not safe!

newtype DynStableName = DynStableName (StableName ())

Expand Down
4 changes: 3 additions & 1 deletion src/System/Mem/StableName/Map.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Most of this code is taken from 'https://github.com/ekmett/stable-maps'.
--------------------------------------------------------------------------------

module System.Mem.StableName.Dynamic.Map
{-# LANGUAGE Safe #-}

module System.Mem.StableName.Map
( Map(..)
, empty
, null
Expand Down

0 comments on commit fe084bb

Please sign in to comment.