1 {-# LANGUAGE FlexibleInstances #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE TemplateHaskell #-}
5 {-# OPTIONS_GHC -fno-warn-orphans #-}
7 module Hkl
.Orphan
where
9 import Data
.Aeson
(FromJSON
(..), ToJSON
(..), Value
(..))
10 import Data
.ByteString
.Char8
(ByteString
)
11 import Data
.Text
.Encoding
(decodeUtf8
, encodeUtf8
)
12 import Foreign
.C
(CDouble
(..))
13 import Foreign
.Storable
(Storable
)
14 import GHC
.Base
(Alternative
(..))
15 import Path
(Abs
, Dir
, Path
, mkAbsDir
)
16 import Test
.QuickCheck
(Arbitrary
(..), elements
)
18 import Prelude
hiding (unwords)
20 import Hkl
.C
.Binoculars
27 instance Arbitrary
(Path Abs Dir
) where
28 arbitrary
= pure
$(mkAbsDir
"/toto")
30 instance Arbitrary HklBinocularsSurfaceOrientationEnum
where
31 arbitrary
= elements
([minBound .. maxBound] :: [HklBinocularsSurfaceOrientationEnum
])
33 instance Arbitrary HklBinocularsQCustomSubProjectionEnum
where
34 arbitrary
= elements
([minBound .. maxBound] :: [HklBinocularsQCustomSubProjectionEnum
])
40 instance ToJSON ByteString
where
41 toJSON
= String . decodeUtf8
44 instance FromJSON ByteString
where
45 parseJSON
(String t
) = pure
. encodeUtf8
$ t
46 parseJSON _
= GHC
.Base
.empty
47 {-# INLINE parseJSON #-}
49 instance ToJSON CDouble
where
50 toJSON
(CDouble d
) = toJSON d
52 instance FromJSON CDouble
where
54 {-# INLINE parseJSON #-}
60 instance (Shape sh
, Storable e
) => Show (Array F sh e
) where
61 show = showShape
. extent