IndentPolicyMultiple let alignment bug #144

Closed
opened 2018-05-16 19:08:34 +02:00 by chreekat · 2 comments
chreekat commented 2018-05-16 19:08:34 +02:00 (Migrated from github.com)

Uncomment the type signature for determineUpdateMeasure to trigger a new, wrong alignment:


-- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple }
buildParticipantRecordAction
    :: ParticipantRecord -> ParticipantStatus -> ParticipantRecordAction
buildParticipantRecordAction participantRecord recordStatus =
    let
        getFieldVal'
            :: (ParticipantRecord -> Maybe (Maybe (a, MeasureDatum)))
            -> Metric
            -> Maybe (Maybe MeasureDatum, Metric)
        getFieldVal' = getFieldVal participantRecord
        changeRecordMeasureIfUsed
            :: Maybe (Maybe MeasureDatum, Metric) -> Maybe MeasureUpdateAction
        changeRecordMeasureIfUsed mValueMetric = do
            (mVal, met) <- mValueMetric
            pure (determineUpdatedMeasure mVal met)
        --determineUpdatedMeasure
        --  :: Maybe MeasureDatum -> Metric -> MeasureUpdateAction
        determineUpdatedMeasure mVal met = case recordStatus of
            Create -> maybe (NoAction met) (Upsert met) mVal
    in ParticipantRecordAction recordStatus (catMaybes measureActions)
Uncomment the type signature for determineUpdateMeasure to trigger a new, wrong alignment: ```haskell -- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple } buildParticipantRecordAction :: ParticipantRecord -> ParticipantStatus -> ParticipantRecordAction buildParticipantRecordAction participantRecord recordStatus = let getFieldVal' :: (ParticipantRecord -> Maybe (Maybe (a, MeasureDatum))) -> Metric -> Maybe (Maybe MeasureDatum, Metric) getFieldVal' = getFieldVal participantRecord changeRecordMeasureIfUsed :: Maybe (Maybe MeasureDatum, Metric) -> Maybe MeasureUpdateAction changeRecordMeasureIfUsed mValueMetric = do (mVal, met) <- mValueMetric pure (determineUpdatedMeasure mVal met) --determineUpdatedMeasure -- :: Maybe MeasureDatum -> Metric -> MeasureUpdateAction determineUpdatedMeasure mVal met = case recordStatus of Create -> maybe (NoAction met) (Upsert met) mVal in ParticipantRecordAction recordStatus (catMaybes measureActions) ```
lspitzner commented 2018-05-16 21:38:48 +02:00 (Migrated from github.com)

thanks for reporting. Almost impressed that you found this bug, as it depended on some nice chain of stuff to become visible. starting with the one-line version of the commented signature fitting into exactly 80 columns, which caused the spacing to not be pruned which.. and so on. heh.

thanks for reporting. Almost impressed that you found this bug, as it depended on some nice chain of stuff to become visible. starting with the one-line version of the commented signature fitting into exactly 80 columns, which caused the spacing to not be pruned which.. and so on. heh.
chreekat commented 2018-05-17 16:35:21 +02:00 (Migrated from github.com)

No problem! This isn't my code, so I can only take half credit. ;) I failed to create a small repro, and had to add back the real code (binary-search-style) until I triggered it. The fact that I could turn it on and off with comments was just icing.

No problem! This isn't my code, so I can only take half credit. ;) I failed to create a small repro, and had to add back the real code (binary-search-style) until I triggered it. The fact that I could turn it on and off with comments was just icing.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#144
There is no content yet.