Skip to content

Commit 1bc44ba

Browse files
committed
-
1 parent 428deda commit 1bc44ba

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

pub/functora/src/bolt11/Functora/Bolt11.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import qualified Data.ByteString as BS
3939
import qualified Data.ByteString.Base16 as B16
4040
import qualified Data.ByteString.Builder as BS
4141
import qualified Data.ByteString.Lazy.Char8 as BL
42-
import Functora.Prelude hiding (error)
42+
import Functora.Prelude hiding (error, show)
4343
import Prelude (Show (..), error)
4444

4545
newtype Hex = Hex

pub/functora/src/prelude/Functora/Prelude.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ import Data.Time.Clock as X
298298
diffTimeToPicoseconds,
299299
diffUTCTime,
300300
nominalDay,
301+
picosecondsToDiffTime,
301302
secondsToDiffTime,
302303
)
303304
import qualified Data.Time.Clock as Clock
@@ -340,7 +341,6 @@ import Universum as X hiding
340341
break,
341342
catch,
342343
catchAny,
343-
decodeUtf8',
344344
drop,
345345
filter,
346346
finally,
@@ -357,7 +357,6 @@ import Universum as X hiding
357357
preview,
358358
print,
359359
set,
360-
show,
361360
state,
362361
swap,
363362
tails,

pub/functora/src/prelude/Functora/PreludeOrphan.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
module Functora.PreludeOrphan () where
55

6+
import Control.Exception.Safe (throw)
67
import Data.Binary (Binary)
78
import qualified Data.Coerce as Coerce
89
import qualified Data.Data as Data
@@ -15,6 +16,7 @@ import Functora.Witch
1516
import Text.URI
1617
import qualified Type.Reflection as Reflection
1718
import Universum
19+
import UnliftIO (MonadUnliftIO (..))
1820
import qualified Prelude
1921
#if defined(__GHCJS__) || defined(ghcjs_HOST_OS) || defined(wasi_HOST_OS)
2022
import Data.JSString (JSString)
@@ -123,6 +125,19 @@ withTarget ::
123125
withTarget =
124126
Coerce.coerce
125127

128+
instance
129+
( Exception e,
130+
MonadCatch m,
131+
MonadUnliftIO m
132+
) =>
133+
MonadUnliftIO (ExceptT e m)
134+
where
135+
withRunInIO inner =
136+
ExceptT . try $ withRunInIO $ \run ->
137+
inner
138+
$ run
139+
. (either throw pure <=< runExceptT)
140+
126141
#if defined(__GHCJS__) || defined(ghcjs_HOST_OS) || defined(wasi_HOST_OS)
127142

128143
instance From String JSString where

pub/proto-lens/proto-lens/src/Data/ProtoLens/Encoding/Wire.hs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
{-# LANGUAGE BangPatterns #-}
88
{-# LANGUAGE CPP #-}
99
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
10+
{-# LANGUAGE StandaloneDeriving #-}
11+
{-# LANGUAGE DerivingStrategies #-}
12+
{-# LANGUAGE DeriveGeneric #-}
13+
{-# LANGUAGE DeriveDataTypeable #-}
1014
module Data.ProtoLens.Encoding.Wire
1115
( Tag(..)
1216
, TaggedValue(..)
@@ -21,6 +25,8 @@ module Data.ProtoLens.Encoding.Wire
2125
, parseMessageSetTaggedValueFromWire
2226
) where
2327

28+
import Data.Data
29+
import GHC.Generics
2430
import Control.DeepSeq (NFData(..))
2531
import Data.Bits ((.&.), (.|.), shiftL, shiftR)
2632
import qualified Data.ByteString as B
@@ -36,6 +42,10 @@ import Data.ProtoLens.Encoding.Bytes
3642
newtype Tag = Tag { unTag :: Int }
3743
deriving (Show, Eq, Ord, Num, NFData)
3844

45+
deriving stock instance Read Tag
46+
deriving stock instance Data Tag
47+
deriving stock instance Generic Tag
48+
3949
-- | The encoding of some unknown field on the wire.
4050
data WireValue
4151
= VarInt !Word64
@@ -46,10 +56,20 @@ data WireValue
4656
| Fixed32 !Word32
4757
deriving (Eq, Ord)
4858

59+
deriving stock instance Show WireValue
60+
deriving stock instance Read WireValue
61+
deriving stock instance Data WireValue
62+
deriving stock instance Generic WireValue
63+
4964
-- | A pair of an encoded field and a value.
5065
data TaggedValue = TaggedValue !Tag !WireValue
5166
deriving (Eq, Ord)
5267

68+
deriving stock instance Show TaggedValue
69+
deriving stock instance Read TaggedValue
70+
deriving stock instance Data TaggedValue
71+
deriving stock instance Generic TaggedValue
72+
5373
type FieldSet = [TaggedValue]
5474

5575
-- TaggedValue, WireValue and Tag are strict, so their NFData instances are

0 commit comments

Comments
 (0)