1364 derived data instances

fixes #1364. @tillmo please review .

It is not possible to derive Data instances for existential data types. Therefore the logic TopHybrid (like the logic Haskell) just produce "null" json. It would be possibly to manually write ToJson instances for these two logics, but that would be a real pain without gain currently. 
this nested maybe is quite cryptic and takes some time to understand. Please write code here that can be grasped more quickly. Or at least pust the big case statement into a where clause.