Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update to new third_party method for haskell deps. #59

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ bazel-opt_task:
- /src/workspace/tools/inject-repo hs-msgpack-rpc-conduit
test_all_script:
- cd /src/workspace && bazel test -k
--remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST
--config=ci
//hs-msgpack-rpc-conduit/...
41 changes: 20 additions & 21 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@ai_formation_hazel//tools:mangling.bzl", "hazel_library")
load("@rules_haskell//haskell:defs.bzl", "haskell_library")
load("//third_party/haskell/hspec-discover:build_defs.bzl", "hspec_test")
load("//tools/project:build_defs.bzl", "project")
Expand All @@ -18,20 +17,20 @@ haskell_library(
deps = [
"//hs-msgpack-binary",
"//hs-msgpack-types",
hazel_library("base"),
hazel_library("binary"),
hazel_library("binary-conduit"),
hazel_library("bytestring"),
hazel_library("conduit"),
hazel_library("conduit-extra"),
hazel_library("data-default-class"),
hazel_library("exceptions"),
hazel_library("monad-control"),
hazel_library("monad-validate"),
hazel_library("mtl"),
hazel_library("network"),
hazel_library("text"),
hazel_library("unliftio-core"),
"//third_party/haskell:base",
"//third_party/haskell:binary",
"//third_party/haskell:binary-conduit",
"//third_party/haskell:bytestring",
"//third_party/haskell:conduit",
"//third_party/haskell:conduit-extra",
"//third_party/haskell:data-default-class",
"//third_party/haskell:exceptions",
"//third_party/haskell:monad-control",
"//third_party/haskell:monad-validate",
"//third_party/haskell:mtl",
"//third_party/haskell:network",
"//third_party/haskell:text",
"//third_party/haskell:unliftio-core",
],
)

Expand All @@ -41,11 +40,11 @@ hspec_test(
compiler_flags = ["-Wno-unused-imports"],
deps = [
":hs-msgpack-rpc-conduit",
hazel_library("async"),
hazel_library("base"),
hazel_library("bytestring"),
hazel_library("hspec"),
hazel_library("mtl"),
hazel_library("network"),
"//third_party/haskell:async",
"//third_party/haskell:base",
"//third_party/haskell:bytestring",
"//third_party/haskell:hspec",
"//third_party/haskell:mtl",
"//third_party/haskell:network",
],
)
1 change: 0 additions & 1 deletion src/Network/MessagePack/Client.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Trustworthy #-}
module Network.MessagePack.Client (
-- * MessagePack Client type
Basic.Client
Expand Down
1 change: 0 additions & 1 deletion src/Network/MessagePack/Client/Basic.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Trustworthy #-}

-------------------------------------------------------------------
-- |
Expand Down
6 changes: 4 additions & 2 deletions src/Network/MessagePack/Client/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
Expand All @@ -20,6 +21,7 @@ import Data.Conduit (ConduitT, SealedConduitT,
(.|))
import qualified Data.Conduit.Binary as CB
import Data.Conduit.Serialization.Binary (sinkGet)
import Data.Kind (Type)
import Data.MessagePack (MessagePack, Object,
defaultConfig, fromObject,
fromObjectWith)
Expand Down Expand Up @@ -50,10 +52,10 @@ newtype ClientT m a

type Client a = ClientT IO a

instance IsClientType m (Returns r) where
instance forall m (r :: Type). IsClientType m (Returns r) where
type ClientType m (Returns r) = ClientT m r

instance IsClientType m (ReturnsM io r) where
instance forall m io (r :: Type). IsClientType m (ReturnsM io r) where
type ClientType m (ReturnsM io r) = ClientT m r


Expand Down
5 changes: 2 additions & 3 deletions src/Network/MessagePack/Interface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StrictData #-}
Expand Down Expand Up @@ -69,15 +68,15 @@ class IsDocType f where

data Returns r

instance Typeable r => IsDocType (Returns r) where
instance Typeable (r :: Type) => IsDocType (Returns r) where
data Doc (Returns r) = Ret Text
deriving (Eq, Read, Show)
flatDoc (Ret retName) =
MethodDocs [] (MethodVal retName (typeName (undefined :: r)))

data ReturnsM (m :: Type -> Type) r

instance Typeable r => IsDocType (ReturnsM m r) where
instance Typeable (r :: Type) => IsDocType (ReturnsM m r) where
data Doc (ReturnsM m r) = RetM Text
deriving (Eq, Read, Show)
flatDoc (RetM retName) =
Expand Down
4 changes: 2 additions & 2 deletions src/Network/MessagePack/Rpc.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
module Network.MessagePack.Rpc
Expand Down Expand Up @@ -45,7 +45,7 @@ data RpcT mc ms f = RpcT
, intfPure :: !(I.Interface f)
}

instance RpcService (RpcT mc ms f) where
instance forall mc ms (f :: Type). RpcService (RpcT mc ms f) where
type ClientMonad (RpcT mc ms f) = mc
type ServerMonad (RpcT mc ms f) = ms
type F (RpcT mc ms f) = f
Expand Down
8 changes: 4 additions & 4 deletions src/Network/MessagePack/Server/Basic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-orphans #-}

-------------------------------------------------------------------
-- |
Expand Down Expand Up @@ -74,6 +73,7 @@ import Data.Conduit.Network (appSink, appSource,
serverSettings,
setAfterBind)
import Data.Conduit.Serialization.Binary (ParseError, sinkGet)
import Data.Kind (Type)
import qualified Data.List as List
import Data.MessagePack (MessagePack, Object,
defaultConfig, fromObject,
Expand Down Expand Up @@ -116,14 +116,14 @@ instance (Functor m, MonadThrow m, MessagePack o) => MethodType m (ServerT m o)
"invalid arguments for method '" <> n <> "': " <> T.pack (show ls)

-- Pure server
instance Monad m => IsReturnType m (Returns r) where
instance forall m (r :: Type). Monad m => IsReturnType m (Returns r) where
type HaskellType (Returns r) = r
type ServerType m (Returns r) = ServerT m r

implement _ = return

-- IO Server
instance MonadIO m => IsReturnType m (ReturnsM IO r) where
instance forall m (r :: Type). MonadIO m => IsReturnType m (ReturnsM IO r) where
type HaskellType (ReturnsM IO r) = IO r
type ServerType m (ReturnsM IO r) = ServerT m r

Expand Down
1 change: 0 additions & 1 deletion src/Network/MessagePack/Types/Client.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE Safe #-}
module Network.MessagePack.Types.Client
( RpcType (..)
, call
Expand Down
1 change: 0 additions & 1 deletion src/Network/MessagePack/Types/Result.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE StrictData #-}
module Network.MessagePack.Types.Result
( Result (..)
Expand Down
1 change: 0 additions & 1 deletion src/Network/MessagePack/Types/Server.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE StrictData #-}
module Network.MessagePack.Types.Server
( MethodVal (..)
Expand Down
Loading