Skip to content

Commit

Permalink
Use fromRight' instead of lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-murphy committed Jul 16, 2021
1 parent 5653c67 commit a1f97fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions recipes/ValueBasedJsonCodecLog/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import Data.Codec.Argonaut (JsonCodec, JsonDecodeError(..), printJsonDecodeError
import Data.Codec.Argonaut as CA
import Data.Codec.Argonaut.Common as CAM
import Data.Codec.Argonaut.Record as CAR
import Data.Either (Either(..), either)
import Data.Either (Either(..), either, fromRight')
import Data.Int as Int
import Data.Maybe (Maybe(..))
import Data.Profunctor (dimap)
import Data.String (splitAt)
import Data.TraversableWithIndex (forWithIndex)
import Effect (Effect)
import Effect.Console (log, logShow)
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafeCrashWith, unsafePartial)

main :: Effect Unit
main = do
Expand Down Expand Up @@ -47,7 +47,7 @@ main = do
log $ stringify $ encode entireRecordCodec exampleValue

exampleJson :: Json
exampleJson = unsafePartial $ (\(Right json) -> json) $ jsonParser
exampleJson = unsafePartial $ (fromRight' \_ -> unsafeCrashWith "got Left: bad parser") $ jsonParser
"""
{
"string":"string value",
Expand Down

0 comments on commit a1f97fe

Please sign in to comment.