higherkindness / mu-haskell

Mu (μ) is a purely functional framework for building micro services.
http://higherkindness.io/mu-haskell/
Apache License 2.0
334 stars 19 forks source link

mu-avro doesn't compile #288

Closed jschaul closed 3 years ago

jschaul commented 3 years ago
mu-avro                          >                 
mu-avro                          > /tmp/stack-fda6ca36c981e9ef/mu-avro-0.4.0.3/test/Avro.hs:23:43: error:
mu-avro                          >     • Couldn't match expected type ‘Gender’
mu-avro                          >                   with actual type ‘Maybe Gender’
mu-avro                          >     • In the fourth argument of ‘Person’, namely ‘(Just Male)’
mu-avro                          >       In the expression:
mu-avro                          >         Person  
mu-avro                          >           "Haskellio"
mu-avro                          >           "Gomez"
mu-avro                          >           (Just 30)
mu-avro                          >           (Just Male)
mu-avro                          >           exampleAddress
mu-avro                          >           [1, 2, 3]
mu-avro                          >           M.empty
mu-avro                          >       In an equation for ‘examplePerson1’:
mu-avro                          >           examplePerson1
mu-avro                          >             = Person
mu-avro                          >                 "Haskellio"
mu-avro                          >                 "Gomez"
mu-avro                          >                 (Just 30)
mu-avro                          >                 (Just Male)
mu-avro                          >                 exampleAddress
mu-avro                          >                 [1, 2, 3]
mu-avro                          >                 M.empty
mu-avro                          >    |            
mu-avro                          > 23 |   = Person "Haskellio" "Gomez" (Just 30) (Just Male) exampleAddress [1,2,3] M.empty
mu-avro                          >    |                                           ^^^^^^^^^
mu-avro                          >                 
mu-avro                          > /tmp/stack-fda6ca36c981e9ef/mu-avro-0.4.0.3/test/Avro.hs:25:39: error:
mu-avro                          >     • Couldn't match expected type ‘Gender’ with actual type ‘Maybe a0’
mu-avro                          >     • In the fourth argument of ‘Person’, namely ‘Nothing’
mu-avro                          >       In the expression:
mu-avro                          >         Person  
mu-avro                          >           "Cuarenta"
mu-avro                          >           "Siete"
mu-avro                          >           Nothing
mu-avro                          >           Nothing
mu-avro                          >           exampleAddress
mu-avro                          >           []    
mu-avro                          >           (M.fromList [("hola", 1), ("hello", 2)])
mu-avro                          >       In an equation for ‘examplePerson2’:
mu-avro                          >           examplePerson2
mu-avro                          >             = Person
mu-avro                          >                 "Cuarenta"
mu-avro                          >                 "Siete"
mu-avro                          >                 Nothing
mu-avro                          >                 Nothing
mu-avro                          >                 exampleAddress
mu-avro                          >                 []
mu-avro                          >                 (M.fromList [("hola", 1), ("hello", 2)])
mu-avro                          >    |            
mu-avro                          > 25 |   = Person "Cuarenta" "Siete" Nothing Nothing exampleAddress []
mu-avro                          >    |                                       ^^^^^^^
mu-avro                          >                 

Using

- mu-rpc-0.4.0.1 # using mu-rpc-0.5.0.0 has no beneficial effect here
- mu-optics-0.3.0.1
- mu-avro-0.4.0.3
- mu-protobuf-0.4.2.0
- mu-schema-0.3.1.2
- mu-grpc-server-0.4.0.0
- mu-grpc-client-0.4.0.1
- mu-grpc-common-0.4.0.0
- compendium-client-0.2.1.1
# dependencies of mu
- http2-client-0.10.0.0
- http2-grpc-types-0.5.0.0
- http2-grpc-proto3-wire-0.1.0.0
- http2-client-grpc-0.8.0.0
- warp-grpc-0.4.0.1
- proto3-wire-1.2.0
- parameterized-0.5.0.0

On a related note, I'm a bit confused about the library structure: I don't want to use mu-avro (at the moment); and I would like to not care about it; however, mu-grpc-common depends on mu-avro, and mu-grpc-server and mu-grpc-client both depend on mu-grpc-common. So I cannot make use of any of your libraries without also importing all the others. Why don't you simply publish one single library called mu to hackage (or at least grouping a few libraries into one)? I cannot at this point import only a subset of the libraries in this repository; so; what's the point of having distinct libraries on hackage if they all depend on each other very tightly? (and, as a result, publishing a new version for one library actually can easily break others)

jschaul commented 3 years ago

I think this may just require a new version release of mu-avro to fix this issue today, as compilation succeeds with a git checkout of lastest master.

More generally, I suppose all package's versions need to be bumped and uploaded to hackage more or less on any change like the one in https://github.com/higherkindness/mu-haskell/issues/288 - perhaps it's worth combining some libraries, or automating this process of bumping&uploading a little further.

serras commented 3 years ago

Thanks for catching this, a new version 0.4.0.4 has been released.

Unfortunately we haven't found a tool to do the corresponding bumps automatically, we've just been able to automate the release of a single one with a command, but you still need to run it.

serras commented 3 years ago

Why don't you simply publish one single library called mu to hackage (or at least grouping a few libraries into one)? I cannot at this point import only a subset of the libraries in this repository; so; what's the point of having distinct libraries on hackage if they all depend on each other very tightly? (and, as a result, publishing a new version for one library actually can easily break others)

This was a decision which in hindsight has not been a good one, I think we should have rather bundled mu-schema, mu-rpc, mu-optics, and all the adapters together. In this particular case, mu-grpc-common requires mu-avro because we allow transport over gRPC to use either Protobuf or Avro serialization. The latter may seem a bit weird, but our sibling library in Scala added this because of user demand, so we went that way too.