Changeset 3328 for src/Pugs/Junc.hs
- Timestamp:
- 05/17/05 11:33:37 (4 years ago)
- svk:copy_cache_prev:
- 4908
- Files:
-
- 1 modified
-
src/Pugs/Junc.hs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Junc.hs
r2725 r3328 15 15 import qualified Data.Set as Set 16 16 17 -- |Construct a @none(...)@ junction from a list of values. 18 -- Delegates to 'opJunc'. 17 {-| 18 Construct a @none(...)@ junction from a list of values. 19 20 Delegates to 'opJunc'. 21 -} 19 22 opJuncNone :: [Val] -> Val 20 23 opJuncNone = opJunc JNone 21 -- |Construct an @all(...)@ junction from a list of values. 22 -- Delegates to 'opJunc'. 24 25 {-| 26 Construct an @all(...)@ junction from a list of values. 27 28 Delegates to 'opJunc'. 29 -} 23 30 opJuncAll :: [Val] -> Val 24 31 opJuncAll = opJunc JAll 25 -- |Construct a n@any(...)@ junction from a list of values. 26 -- Delegates to 'opJunc'. 32 33 {-| 34 Construct a n@any(...)@ junction from a list of values. 35 36 Delegates to 'opJunc'. 37 -} 27 38 opJuncAny :: [Val] -> Val 28 39 opJuncAny = opJunc JAny 29 -- |Construct a @one(...)@ junction from a list of values. 30 -- Handled differently! 40 41 {-| 42 Construct a @one(...)@ junction from a list of values. 43 44 Does /not/ delegate to 'opJunc'! 45 -} 31 46 opJuncOne :: [Val] -> Val 32 47 opJuncOne args = VJunc (MkJunc JOne dups vals) … … 36 51 groups = group $ sort args 37 52 38 -- |Construct a junction of the specified junctive type, containing all the 39 -- values in the list. 53 {-| 54 Construct a junction of the specified junctive type, containing all the 55 values in the list. 56 -} 40 57 opJunc :: JuncType -> [Val] -> Val 41 58 opJunc t vals = VJunc $ MkJunc t Set.empty (joined `Set.union` Set.fromList vs) … … 46 63 sameType _ = False 47 64 48 -- |Check if the specified value is a 'VJunc' of one of the specified 49 -- junctive types. 65 {-| 66 Check if the specified value is a 'VJunc' of one of the specified 67 junctive types. If it is, return it as a 'VJunc'. 68 -} 50 69 juncTypeIs :: Val -- ^ Value to test 51 70 -> [JuncType] -- ^ Types to check against … … 58 77 = Nothing 59 78 79 mergeJunc :: JuncType -> [Val] -> [Val] -> VJunc 60 80 mergeJunc j ds vs 61 81 = case j of … … 90 110 appList _ _ = internalError "appList: list doesn't begin with ApplyArg" 91 111 112 isTotalJunc :: ApplyArg -> Bool 92 113 isTotalJunc arg 93 114 | (ApplyArg _ (VJunc j) b) <- arg … … 97 118 = False 98 119 120 isPartialJunc :: ApplyArg -> Bool 99 121 isPartialJunc arg 100 122 | (ApplyArg _ (VJunc j) b) <- arg
