Commit ac59cad0 authored by Petr Pudlak's avatar Petr Pudlak

Add macros for the version of monad-control

.. to the Makefile as well as to the Haskell modules where it will be
needed.

While at it, fix spacing so that command lines start with tabs, as they
should.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent f73825de
......@@ -1177,11 +1177,18 @@ HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
hs-pkg-versions:
ghc-pkg list --simple-output lens \
| sed -r -e '$$!d' \
-e 's/^lens-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
-e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
-DLENS_MAJOR=\1 -DLENS_MINOR=\2 -DLENS_REV=\3/' \
-e 's/^\s*//' \
-e 's/^lens-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
-e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
-DLENS_MAJOR=\1 -DLENS_MINOR=\2 -DLENS_REV=\3/' \
-e 's/^\s*//' \
> $@
ghc-pkg list --simple-output monad-control \
| sed -r -e '$$!d' \
-e 's/^monad-control-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
-e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
-DMONAD_CONTROL_MAJOR=\1 -DMONAD_CONTROL_MINOR=\2 -DMONAD_CONTROL_REV=\3/'\
-e 's/^\s*//' \
>> $@
HS_MAKEFILE_GHC_SRCS = $(HS_SRC_PROGS:%=%.hs)
if WANT_HSTESTS
......
......@@ -2,6 +2,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE CPP #-}
{-
......@@ -73,6 +74,14 @@ module Ganeti.BasicTypes
, emptyListSet
) where
-- The following macro is just a temporary solution for 2.12 and 2.13.
-- Since 2.14 cabal creates proper macros for all dependencies.
#define MIN_VERSION_monad_control(maj,min,rev) \
(((maj)<MONAD_CONTROL_MAJOR)|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
((rev)<=MONAD_CONTROL_REV)))
import Control.Applicative
import Control.Exception (try)
import Control.Monad
......
{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
MultiParamTypeClasses #-}
MultiParamTypeClasses, CPP #-}
{-| A pure implementation of MonadLog using MonadWriter
......@@ -45,6 +45,14 @@ module Ganeti.Logging.WriterLog
, execWriterLog
) where
-- The following macro is just a temporary solution for 2.12 and 2.13.
-- Since 2.14 cabal creates proper macros for all dependencies.
#define MIN_VERSION_monad_control(maj,min,rev) \
(((maj)<MONAD_CONTROL_MAJOR)|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
((rev)<=MONAD_CONTROL_REV)))
import Control.Applicative
import Control.Monad
import Control.Monad.Base
......
{-# LANGUAGE TemplateHaskell, FunctionalDependencies, FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell, FunctionalDependencies, FlexibleContexts, CPP #-}
-- {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
{-| Creates a client out of list of RPC server components.
......@@ -42,6 +42,14 @@ module Ganeti.THH.HsRPC
, mkRpcCalls
) where
-- The following macro is just a temporary solution for 2.12 and 2.13.
-- Since 2.14 cabal creates proper macros for all dependencies.
#define MIN_VERSION_monad_control(maj,min,rev) \
(((maj)<MONAD_CONTROL_MAJOR)|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
((rev)<=MONAD_CONTROL_REV)))
import Control.Applicative
import Control.Monad
import Control.Monad.Base
......
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies,
TemplateHaskell, CPP #-}
{-| All RPC calls are run within this monad.
......@@ -65,6 +65,14 @@ module Ganeti.WConfd.Monad
, readTempResState
) where
-- The following macro is just a temporary solution for 2.12 and 2.13.
-- Since 2.14 cabal creates proper macros for all dependencies.
#define MIN_VERSION_monad_control(maj,min,rev) \
(((maj)<MONAD_CONTROL_MAJOR)|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
(((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
((rev)<=MONAD_CONTROL_REV)))
import Control.Applicative
import Control.Arrow ((&&&), second)
import Control.Monad
......@@ -244,14 +252,14 @@ modifyConfigStateErr f = do
when modified $ do
if distSync
then do
logDebug "Triggering config write\
\ together with full synchronous distribution"
logDebug $ "Triggering config write" ++
" together with full synchronous distribution"
liftBase . triggerAndWait (Any True) . dhSaveConfigWorker $ dh
logDebug "Config write and distribution finished"
else do
-- trigger the config. saving worker and wait for it
logDebug "Triggering config write\
\ and asynchronous distribution"
logDebug $ "Triggering config write" ++
" and asynchronous distribution"
liftBase . triggerAndWait (Any False) . dhSaveConfigWorker $ dh
return ()
return r
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment