File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
unison-runtime/src/Unison/Runtime/Foreign Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -901,7 +901,9 @@ foreignCallHelper = \case
901
901
List_sort -> mkForeign $ \ (l :: Seq Val ) -> pure $ Sq. unstableSort l
902
902
Multimap_fromList -> mkForeign $ \ (l :: [(Val , Val )]) -> do
903
903
let listVals = l <&> \ (k, v) -> (k, Sq. singleton v)
904
- evaluate $ Map. fromListWith (<>) listVals
904
+ -- Haskell Map.fromList calls the semigroup in reverse order, so we correct for it by flipping.
905
+ let result :: Map Val Val = fmap encodeVal $ Map. fromListWith (flip (<>) ) listVals
906
+ evaluate result
905
907
Set_fromList -> mkForeign $ \ (l :: [Val ]) -> do
906
908
m <- evaluate $ Map. fromList $ zip l (repeat unitValue)
907
909
pure . Data1 Ty. setRef TT. setWrapTag $ encodeVal m
You can’t perform that action at this time.
0 commit comments