1
+ {-# LANGUAGE CPP #-}
1
2
{-# LANGUAGE FlexibleContexts, BangPatterns, TypeFamilies #-}
2
3
3
4
{-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -119,6 +120,9 @@ instance SafeCopy VersionRange where
119
120
instance SafeCopy OS where
120
121
errorTypeName _ = " OS"
121
122
123
+ #if !MIN_VERSION_Cabal_syntax(3,11,0)
124
+ putCopy (OtherOS " haiku" ) = contain $ putWord8 18
125
+ #endif
122
126
putCopy (OtherOS s) = contain $ putWord8 0 >> safePut s
123
127
putCopy Linux = contain $ putWord8 1
124
128
putCopy Windows = contain $ putWord8 2
@@ -137,6 +141,9 @@ instance SafeCopy OS where
137
141
putCopy Hurd = contain $ putWord8 15
138
142
putCopy Android = contain $ putWord8 16
139
143
putCopy Wasi = contain $ putWord8 17
144
+ #if MIN_VERSION_Cabal_syntax(3,11,0)
145
+ putCopy Haiku = contain $ putWord8 18
146
+ #endif
140
147
141
148
getCopy = contain $ do
142
149
tag <- getWord8
@@ -159,6 +166,11 @@ instance SafeCopy OS where
159
166
15 -> return Hurd
160
167
16 -> return Android
161
168
17 -> return Wasi
169
+ #if MIN_VERSION_Cabal_syntax(3,11,0)
170
+ 18 -> return Haiku
171
+ #else
172
+ 18 -> return $ OtherOS " haiku"
173
+ #endif
162
174
_ -> fail " SafeCopy OS getCopy: unexpected tag"
163
175
164
176
instance SafeCopy Arch where
@@ -382,7 +394,13 @@ instance Arbitrary OS where
382
394
arbitrary = oneof [ pure OtherOS <*> vectorOf 3 (choose (' A' , ' Z' ))
383
395
, pure Linux , pure Windows , pure OSX , pure FreeBSD
384
396
, pure OpenBSD , pure NetBSD , pure Solaris , pure AIX
385
- , pure HPUX , pure IRIX , pure HaLVM , pure IOS ]
397
+ , pure HPUX , pure IRIX , pure HaLVM , pure IOS
398
+ #if MIN_VERSION_Cabal_syntax(3,11,0)
399
+ , pure Haiku
400
+ #else
401
+ , pure $ OtherOS " haiku"
402
+ #endif
403
+ ]
386
404
387
405
instance Arbitrary FlagName where
388
406
arbitrary = mkFlagName <$> vectorOf 4 (choose (' a' , ' z' ))
0 commit comments