Skip to content

Commit 28eb148

Browse files
committed
getting to -Wall
1 parent d12eb74 commit 28eb148

37 files changed

+348
-406
lines changed

src/SubHask.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
module SubHask
44
( module SubHask.Algebra
55
, module SubHask.Category
6-
, module SubHask.Compatibility.Base
6+
-- , module SubHask.Compatibility.Base
77
, module SubHask.Internal.Prelude
88
, module SubHask.Monad
99
, module SubHask.SubType
1010
) where
1111

1212
import SubHask.Algebra
1313
import SubHask.Category
14-
import SubHask.Compatibility.Base
14+
import SubHask.Compatibility.Base()
1515
import SubHask.Internal.Prelude
1616
import SubHask.Monad
1717
import SubHask.SubType

src/SubHask/Algebra.hs

+37-42
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{-# LANGUAGE CPP,MagicHash,UnboxedTuples #-}
2+
{-# OPTIONS_GHC -fno-warn-missing-methods #-}
3+
{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
4+
{-# OPTIONS_GHC -fno-warn-orphans #-}
25

36
-- | This module defines the algebraic type-classes used in subhask.
47
-- The class hierarchies are significantly more general than those in the standard Prelude.
@@ -51,14 +54,11 @@ module SubHask.Algebra
5154
, law_Heyting_infleft
5255
, law_Heyting_infright
5356
, law_Heyting_distributive
54-
, Boolean (..)
57+
, Boolean
5558
, law_Boolean_infcomplement
5659
, law_Boolean_supcomplement
5760
, law_Boolean_infdistributivity
5861
, law_Boolean_supdistributivity
59-
60-
-- , defn_Latticelessthaninf
61-
-- , defn_Latticelessthansup
6262
, Ord_ (..)
6363
, law_Ord_totality
6464
, law_Ord_min
@@ -73,12 +73,12 @@ module SubHask.Algebra
7373
, minimum_
7474
, argmin
7575
, argmax
76-
-- , argminimum_
77-
-- , argmaximum_
7876
, Graded (..)
7977
, law_Graded_fromEnum
8078
, law_Graded_pred
8179
, defn_Graded_predN
80+
, (>.)
81+
, (<.)
8282
, Enum (..)
8383
, law_Enum_toEnum
8484
, law_Enum_succ
@@ -94,6 +94,7 @@ module SubHask.Algebra
9494

9595
-- * Set-like
9696
, Elem
97+
, infDisjoint
9798
, SetElem
9899
, Container (..)
99100
, law_Container_preservation
@@ -127,6 +128,7 @@ module SubHask.Algebra
127128
, defn_Foldable_foldl1'
128129

129130
, foldtree1
131+
, convertUnfoldable
130132
, length
131133
, reduce
132134
, concat
@@ -169,6 +171,8 @@ module SubHask.Algebra
169171
, Semigroup (..)
170172
, law_Semigroup_associativity
171173
, defn_Semigroup_plusequal
174+
, associator
175+
, cycle
172176
, Actor
173177
, Action (..)
174178
, law_Action_compatibility
@@ -184,7 +188,7 @@ module SubHask.Algebra
184188
, law_Monoid_leftid
185189
, law_Monoid_rightid
186190
, defn_Monoid_isZero
187-
, Abelian (..)
191+
, Abelian
188192
, law_Abelian_commutative
189193
, Group (..)
190194
, law_Group_leftinverse
@@ -215,7 +219,7 @@ module SubHask.Algebra
215219
-- , roundUpToNearestBase2
216220
, fromIntegral
217221
, Field(..)
218-
, OrdField(..)
222+
, OrdField
219223
, RationalField(..)
220224
, convertRationalField
221225
, toFloat
@@ -260,8 +264,12 @@ module SubHask.Algebra
260264
, defn_FreeModule_dotstardotequal
261265
, FiniteModule (..)
262266
, VectorSpace (..)
267+
, Reisz (..)
263268
, Banach (..)
269+
, law_Banach_distance
270+
, law_Banach_size
264271
, Hilbert (..)
272+
, squaredInnerProductNorm
265273
, innerProductDistance
266274
, innerProductNorm
267275
, TensorAlgebra (..)
@@ -281,26 +289,20 @@ import qualified Data.Number.Erf as P
281289
import qualified Math.Gamma as P
282290
import qualified Data.List as L
283291

284-
import Prelude (Ordering (..))
285292
import Control.Monad hiding (liftM)
286293
import Control.Monad.ST
287294
import Data.Ratio
288295
import Data.Typeable
289-
import Test.QuickCheck (Arbitrary (..), frequency)
296+
import Test.QuickCheck (frequency)
290297

291-
import Control.Concurrent
292-
import Control.Parallel
293298
import Control.Parallel.Strategies
294-
import System.IO.Unsafe -- used in the parallel function
295299

296300
import GHC.Prim hiding (Any)
297301
import GHC.Types
298-
import GHC.Magic
299302

300303
import SubHask.Internal.Prelude
301304
import SubHask.Category
302305
import SubHask.Mutable
303-
import SubHask.SubType
304306

305307

306308
-------------------------------------------------------------------------------
@@ -493,7 +495,7 @@ instance MinBound_ Float where minBound = -1/0 ; {-# INLINE minBound #-
493495
instance MinBound_ Double where minBound = -1/0 ; {-# INLINE minBound #-}
494496
-- FIXME: should be a primop for this
495497

496-
instance MinBound_ b => MinBound_ (a -> b) where minBound = \x -> minBound ; {-# INLINE minBound #-}
498+
instance MinBound_ b => MinBound_ (a -> b) where minBound = \_ -> minBound ; {-# INLINE minBound #-}
497499

498500
-------------------
499501

@@ -712,16 +714,16 @@ law_Graded_fromEnum b1 b2
712714
| otherwise = True
713715

714716
law_Graded_pred :: Graded b => b -> b -> Bool
715-
law_Graded_pred b1 b2 = fromEnum (pred b1) == fromEnum b1-1
717+
law_Graded_pred b1 _ = fromEnum (pred b1) == fromEnum b1-1
716718
|| fromEnum (pred b1) == fromEnum b1
717719

718720
defn_Graded_predN :: Graded b => Int -> b -> Bool
719721
defn_Graded_predN i b
720722
| i < 0 = true
721723
| otherwise = go i b == predN i b
722724
where
723-
go 0 b = b
724-
go i b = go (i-1) $ pred b
725+
go 0 b' = b'
726+
go i' b' = go (i'-1) $ pred b'
725727

726728
instance Graded Bool where
727729
{-# INLINE pred #-}
@@ -789,7 +791,7 @@ law_Enum_toEnum :: Enum b => b -> Bool
789791
law_Enum_toEnum b = toEnum (fromEnum b) == b
790792

791793
law_Enum_succ :: Enum b => b -> b -> Bool
792-
law_Enum_succ b1 b2 = fromEnum (succ b1) == fromEnum b1+1
794+
law_Enum_succ b1 _ = fromEnum (succ b1) == fromEnum b1+1
793795
|| fromEnum (succ b1) == fromEnum b1
794796

795797
defn_Enum_succN :: Enum b => Int -> b -> Logic b
@@ -903,7 +905,7 @@ instance Bounded Double where maxBound = 1/0 ; {-# INLINE maxBound #-}
903905

904906
instance Bounded b => Bounded (a -> b) where
905907
{-# INLINE maxBound #-}
906-
maxBound = \x -> maxBound
908+
maxBound = \_ -> maxBound
907909

908910
--------------------
909911

@@ -1145,7 +1147,7 @@ instance Monoid () where
11451147

11461148
instance Monoid b => Monoid (a -> b) where
11471149
{-# INLINE zero #-}
1148-
zero = \a -> zero
1150+
zero = \_ -> zero
11491151

11501152
---------------------------------------
11511153

@@ -1333,7 +1335,7 @@ instance Rig Rational where one = 1 ; {-# INLINE one #-}
13331335

13341336
instance Rig b => Rig (a -> b) where
13351337
{-# INLINE one #-}
1336-
one = \a -> one
1338+
one = \_ -> one
13371339

13381340
---------------------------------------
13391341

@@ -1381,7 +1383,7 @@ instance Ring Rational where fromInteger = P.fromInteger ; {-# INLINE fromInt
13811383

13821384
instance Ring b => Ring (a -> b) where
13831385
{-# INLINE fromInteger #-}
1384-
fromInteger i = \a -> fromInteger i
1386+
fromInteger i = \_ -> fromInteger i
13851387

13861388
{-# INLINABLE indicator #-}
13871389
indicator :: Ring r => Bool -> r
@@ -2009,7 +2011,7 @@ instance
20092011
) => FreeModule (a -> b)
20102012
where
20112013
g .*. f = \a -> g a .*. f a
2012-
ones = \a -> ones
2014+
ones = \_ -> ones
20132015

20142016
---------------------------------------
20152017

@@ -2162,7 +2164,7 @@ innerProductNorm = undefined -- sqrt . squaredInnerProductNorm
21622164

21632165
{-# INLINE innerProductDistance #-}
21642166
innerProductDistance :: Hilbert v => v -> v -> Scalar v
2165-
innerProductDistance v1 v2 = undefined --innerProductNorm $ v1-v2
2167+
innerProductDistance _ _ = undefined --innerProductNorm $ v1-v2
21662168

21672169
---------------------------------------
21682170

@@ -2332,9 +2334,6 @@ instance CanError Double where
23322334

23332335
-------------------------------------------------------------------------------
23342336
-- set-like
2335-
2336-
type Item s = Elem s
2337-
23382337
type family Elem s
23392338
type family SetElem s t
23402339

@@ -2623,11 +2622,11 @@ foldtree1 :: Monoid a => [a] -> a
26232622
foldtree1 as = case go as of
26242623
[] -> zero
26252624
[a] -> a
2626-
as -> foldtree1 as
2625+
as' -> foldtree1 as'
26272626
where
26282627
go [] = []
26292628
go [a] = [a]
2630-
go (a1:a2:as) = (a1+a2):go as
2629+
go (a1:a2:as'') = (a1+a2):go as''
26312630

26322631
{-# INLINE[1] convertUnfoldable #-}
26332632
convertUnfoldable :: (Monoid t, Foldable s, Constructible t, Elem s ~ Elem t) => s -> t
@@ -2729,10 +2728,6 @@ class (Boolean (Logic s), Boolean s, Container s) => Topology s where
27292728
type family Index s
27302729
type family SetIndex s a
27312730

2732-
-- | FIXME:
2733-
-- This type is a hack designed to work around the lack of injective type families.
2734-
type ValidSetIndex s = SetIndex s (Index s) ~ s
2735-
27362731
-- | An indexed constructible container associates an 'Index' with each 'Elem'.
27372732
-- This class generalizes the map abstract data type.
27382733
--
@@ -2945,8 +2940,8 @@ type instance Index [a] = Int
29452940

29462941
instance ValidEq a => Eq_ [a] where
29472942
(x:xs)==(y:ys) = x==y && xs==ys
2948-
(x:xs)==[] = false
2949-
[] ==(y:ts) = false
2943+
(_:_)==[] = false
2944+
[] ==(_:_) = false
29502945
[] ==[] = true
29512946

29522947
instance Eq a => POrd_ [a] where
@@ -3002,8 +2997,8 @@ instance Foldable [a] where
30022997
foldl1' = L.foldl1'
30032998

30042999
instance ValidLogic a => IxContainer [a] where
3005-
lookup 0 (x:xs) = Just x
3006-
lookup i (x:xs) = lookup (i-1) xs
3000+
lookup 0 (x:_) = Just x
3001+
lookup i (_:xs) = lookup (i-1) xs
30073002
lookup _ [] = Nothing
30083003

30093004
imap f xs = map (uncurry f) $ P.zip [0..] xs
@@ -3120,7 +3115,7 @@ type instance Elem (Labeled' x y) = Elem x
31203115
-----
31213116

31223117
instance Eq_ x => Eq_ (Labeled' x y) where
3123-
(Labeled' x1 y1) == (Labeled' x2 y2) = x1==x2
3118+
(Labeled' x1 _) == (Labeled' x2 _) = x1==x2
31243119

31253120
instance (ClassicalLogic x, Ord_ x) => POrd_ (Labeled' x y) where
31263121
inf (Labeled' x1 y1) (Labeled' x2 y2) = if x1 < x2
@@ -3142,8 +3137,8 @@ instance Semigroup x => Action (Labeled' x y) where
31423137
(Labeled' x y) .+ x' = Labeled' (x'+x) y
31433138

31443139
instance Metric x => Metric (Labeled' x y) where
3145-
distance (Labeled' x1 y1) (Labeled' x2 y2) = distance x1 x2
3146-
distanceUB (Labeled' x1 y1) (Labeled' x2 y2) = distanceUB x1 x2
3140+
distance (Labeled' x1 _) (Labeled' x2 _) = distance x1 x2
3141+
distanceUB (Labeled' x1 _) (Labeled' x2 _) = distanceUB x1 x2
31473142

31483143
instance Normed x => Normed (Labeled' x y) where
31493144
size (Labeled' x _) = size x

0 commit comments

Comments
 (0)