Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generics error when breaking line #1134

Closed
2 of 3 tasks
fc1943s opened this issue Sep 13, 2020 · 1 comment · Fixed by #1135
Closed
2 of 3 tasks

Generics error when breaking line #1134

fc1943s opened this issue Sep 13, 2020 · 1 comment · Fixed by #1135

Comments

@fc1943s
Copy link

fc1943s commented Sep 13, 2020

Issue created from fantomas-online

Code

module Services =
    /// Builds a Stream Resolve function appropriate to the store being used
    type StreamResolver(storage: Storage.Instance) =
        member __.Resolve
            (
                codec: FsCodec.IEventCodec<'event, byte [], _>,
                fold: ('state -> 'event seq -> 'state),
                initial: 'state,
                snapshot: (('event -> bool) * ('state -> 'event))
            )
            =
            match storage with
            | Storage.MemoryStore store ->
                Equinox.MemoryStore.Resolver(store, FsCodec.Box.Codec.Create(), fold, initial).Resolve
            | Storage.EventStore (gateway, cache) ->
                let accessStrategy =
                    Equinox.EventStore.AccessStrategy.RollingSnapshots snapshot

                let cacheStrategy =
                    Equinox.EventStore.CachingStrategy.SlidingWindow(cache, TimeSpan.FromMinutes 20.)

                Equinox.EventStore.Resolver<'event, 'state, _>(gateway, codec, fold, initial, cacheStrategy, accessStrategy).Resolve

Result

module Services =
    /// Builds a Stream Resolve function appropriate to the store being used
    type StreamResolver(storage: Storage.Instance) =
        member __.Resolve(codec: FsCodec.IEventCodec<'event, byte [], _>,
                          fold: ('state -> 'event seq -> 'state),
                          initial: 'state,
                          snapshot: (('event -> bool) * ('state -> 'event))) =
            match storage with
            | Storage.MemoryStore store ->
                Equinox.MemoryStore.Resolver(store, FsCodec.Box.Codec.Create(), fold, initial).Resolve
            | Storage.EventStore (gateway, cache) ->
                let accessStrategy =
                    Equinox.EventStore.AccessStrategy.RollingSnapshots snapshot

                let cacheStrategy =
                    Equinox.EventStore.CachingStrategy.SlidingWindow(cache, TimeSpan.FromMinutes 20.)
                Equinox.EventStore.Resolver<'event, 'state, _>
                    (gateway, codec, fold, initial, cacheStrategy, accessStrategy)
                    .Resolve

Problem description

Please describe here fantomas problem you encountered.

Before:
image

After:
image

image

Source code:
https://github.com/jet/dotnet-templates/blob/master/equinox-web/Web/Startup.fs
(dotnet new -i Equinox.Templates --> dotnet new eqxweb -t -e)

EDIT:
If I remove the generic type alias the formatting stops breaking the line, but still crossing the configured 120 limit
image

Does the configuration options support something like this?
image

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 09/10/2020 21:17:15 - 5632847

Default Fantomas configuration

@nojaf
Copy link
Contributor

nojaf commented Sep 13, 2020

Hey, thanks for reporting this issue. It rings a bell 😅.

Does the configuration options support something like this?

No, please upvote #501 for this.

Lastly, you might be interested in the fsharp_alternative_long_member_definitions setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants