caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] type keyword indentation with tuareg
@ 2017-01-23  8:19 Christophe Raffalli
  2017-01-24  8:46 ` Louis Gesbert
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Raffalli @ 2017-01-23  8:19 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]


Hello,

I search briefly on google and found nothing suprinsingly ... OCaml modern extension
seems badly supported by tuareg. In particular the type keyword for polymorphic type:

let f : type a.a -> a =
          fun x -> x

Does anyone have a quick fix ?

Cheers,
Christophe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] type keyword indentation with tuareg
  2017-01-23  8:19 [Caml-list] type keyword indentation with tuareg Christophe Raffalli
@ 2017-01-24  8:46 ` Louis Gesbert
  2017-01-24 11:47   ` Christophe Troestler
  2017-01-24 12:35   ` Daniel Bünzli
  0 siblings, 2 replies; 6+ messages in thread
From: Louis Gesbert @ 2017-01-24  8:46 UTC (permalink / raw)
  To: caml-list, Christophe Raffalli

Try ocp-indent (http://opam.ocaml.org/packages/ocp-indent/) for better indentation, based on a token stack rather than regexps. It plugs in to tuareg easily.

(and gives:

    let f : type a.a -> a =
      fun x -> x

)

> - Christophe Raffalli, 23/01/2017 09:19 -
> 
> Hello,
> 
> I search briefly on google and found nothing suprinsingly ... OCaml modern extension
> seems badly supported by tuareg. In particular the type keyword for polymorphic type:
> 
> let f : type a.a -> a =
>           fun x -> x
> 
> Does anyone have a quick fix ?
> 
> Cheers,
> Christophe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] type keyword indentation with tuareg
  2017-01-24  8:46 ` Louis Gesbert
@ 2017-01-24 11:47   ` Christophe Troestler
  2017-01-24 12:35   ` Daniel Bünzli
  1 sibling, 0 replies; 6+ messages in thread
From: Christophe Troestler @ 2017-01-24 11:47 UTC (permalink / raw)
  To: caml-list, Christophe Raffalli

Hi,

On 2017-01-24, Louis Gesbert wrote:
> 
>     let f : type a.a -> a =
>       fun x -> x

That’s the indentation the development version of Tuareg gives as well 
(with SMIE enabled).

Best,
C.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] type keyword indentation with tuareg
  2017-01-24  8:46 ` Louis Gesbert
  2017-01-24 11:47   ` Christophe Troestler
@ 2017-01-24 12:35   ` Daniel Bünzli
  2017-01-24 13:00     ` Louis Gesbert
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Bünzli @ 2017-01-24 12:35 UTC (permalink / raw)
  To: Louis Gesbert; +Cc: caml-list, Christophe Raffalli

On Tuesday, 24 January 2017 at 09:46, Louis Gesbert wrote:
> Try ocp-indent (http://opam.ocaml.org/packages/ocp-indent/) for better indentation, based on a token stack rather than regexps. It plugs in to tuareg easily.
> 
> (and gives:
> 
> let f : type a.a -> a =
> fun x -> x
> )

Is this released ? With [2], the `fun` gets indented. There's an old issue about this [1]

Best, 

Daniel

[1] https://github.com/OCamlPro/ocp-indent/issues/188
[2]
> ocp-indent --version
1.5.3
> ocp-indent --print-config
base = 2
type = 2
in = 0
with = 0
match_clause = 2
ppx_stritem_ext = 2
max_indent = 4
strict_with = never
strict_else = always
strict_comments = false
align_ops = true

align_params = auto


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] type keyword indentation with tuareg
  2017-01-24 12:35   ` Daniel Bünzli
@ 2017-01-24 13:00     ` Louis Gesbert
  2017-01-24 13:10       ` Daniel Bünzli
  0 siblings, 1 reply; 6+ messages in thread
From: Louis Gesbert @ 2017-01-24 13:00 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: caml-list, Christophe Raffalli

`fun` does indeed get indented (by 2), as mentionned in the issue you linked to.
The issue Christophe Raffalli was having here had to do with the `type` keyword in the function type leading to a much higher indentation level, though, if I understood correctly: a problem that is apparently solved by either ocp-indent or a more recent version of Tuareg+SMIE.

Best,
Louis Gesbert - OCamlPro

> - Daniel Bünzli, 24/01/2017 13:35 -
> On Tuesday, 24 January 2017 at 09:46, Louis Gesbert wrote:
> > Try ocp-indent (http://opam.ocaml.org/packages/ocp-indent/) for better indentation, based on a token stack rather than regexps. It plugs in to tuareg easily.
> > 
> > (and gives:
> > 
> > let f : type a.a -> a =
> > fun x -> x
> > )
> 
> Is this released ? With [2], the `fun` gets indented. There's an old issue about this [1]
> 
> Best, 
> 
> Daniel
> 
> [1] https://github.com/OCamlPro/ocp-indent/issues/188
> [2]
> > ocp-indent --version
> 1.5.3
> > ocp-indent --print-config
> base = 2
> type = 2
> in = 0
> with = 0
> match_clause = 2
> ppx_stritem_ext = 2
> max_indent = 4
> strict_with = never
> strict_else = always
> strict_comments = false
> align_ops = true
> 
> align_params = auto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] type keyword indentation with tuareg
  2017-01-24 13:00     ` Louis Gesbert
@ 2017-01-24 13:10       ` Daniel Bünzli
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Bünzli @ 2017-01-24 13:10 UTC (permalink / raw)
  To: Louis Gesbert; +Cc: caml-list, Christophe Raffalli

On Tuesday, 24 January 2017 at 14:00, Louis Gesbert wrote:
> `fun` does indeed get indented (by 2), as mentionned in the issue you linked to.

Ah sorry, it seems my mailer is lying to me; it wasn't showing the indent of your message which I now see by looking at the source.

D



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-24 13:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23  8:19 [Caml-list] type keyword indentation with tuareg Christophe Raffalli
2017-01-24  8:46 ` Louis Gesbert
2017-01-24 11:47   ` Christophe Troestler
2017-01-24 12:35   ` Daniel Bünzli
2017-01-24 13:00     ` Louis Gesbert
2017-01-24 13:10       ` Daniel Bünzli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).