Jugendhackt / haskell-ricochet

(WIP/Experimental) Ricochet implementation as Haskell Library.
GNU General Public License v3.0
22 stars 0 forks source link

Include hprotoc in the build system #10

Closed photm5 closed 9 years ago

photm5 commented 9 years ago

I tried to add a pre-config hook to Setup.hs, using this code:

import Distribution.Simple
import Data.Monoid((<>))

curry2 :: ((a -> b -> c) -> (a1 -> b1 -> c1) -> d) -> (((a, b) -> c) -> ((a1, b1) -> c1) -> d)
curry2 = flip (.) curry . flip . flip (.) curry . flip

combine' :: (Monad m, Monoid b) => (a -> m b) -> (a -> m b) -> (a -> m b)
combine' f g x = f x >>= \rf -> g x >>= \rg -> return $ rf <> rg

--combine :: (Monad m, Monoid c) => (a -> b -> m c) -> (a -> b -> m c) -> (a -> b -> m c)
--combine = uncurry . combine' . curry2

preConfHook = preConf simpleUserHooks `combine` const const (putStrLn "test")
main = defaultMainWithHooks $ simpleUserHooks { preConf = preConfHook }

Sadly, the commented out part doesn’t compile.

sternenseemann commented 9 years ago

So unproductive

photm5 commented 9 years ago

The command we need to execute is:

hprotoc --haskell_out=src/Network/Ricochet --proto_path=src/Network/Ricochet/Protocol AuthHiddenService.proto  ChatChannel.proto  ContactRequestChannel.proto  ControlChannel.proto
photm5 commented 9 years ago

As of 8d7ac15, we’ll need to add /proto to the end of the --proto_path option.