[contrib][haskell] Calib
[hkl.git] / contrib / haskell / src / Hkl / PyFAI / Calib.hs
blob1c41a09b26a1e2bbc0ae2965b56fcf5ec2d768d6
1 {-# LANGUAGE FlexibleInstances #-}
2 {-# LANGUAGE GADTs #-}
3 {-# LANGUAGE UnicodeSyntax #-}
5 module Hkl.PyFAI.Calib
6 ( ToPyFAICalibArg(..) ) where
8 import Data.Text (unpack)
9 import Numeric.Units.Dimensional.Prelude ((/~), nano, meter)
11 import Hkl.Types ( WaveLength )
12 import Hkl.Detector ( Detector )
13 import Hkl.PyFAI.Calibrant ( Calibrant )
14 import Hkl.PyFAI.Detector ( toPyFAI )
16 class ToPyFAICalibArg a where
17 toPyFAICalibArg ∷ a → String
19 instance ToPyFAICalibArg FilePath where
20 toPyFAICalibArg f = f
22 instance ToPyFAICalibArg (Detector a) where
23 toPyFAICalibArg d = "-D" ++ unpack (toPyFAI d)
25 instance ToPyFAICalibArg Calibrant where
26 toPyFAICalibArg c = "-c " ++ show c
28 instance ToPyFAICalibArg WaveLength where
29 toPyFAICalibArg w = "-w " ++ show ((w /~ nano meter) * 10)