Skip to content

Instantly share code, notes, and snippets.

@yawaramin
Last active May 5, 2025 13:03
Show Gist options
  • Select an option

  • Save yawaramin/b86557ae81cbd019fcb9e071abe594de to your computer and use it in GitHub Desktop.

Select an option

Save yawaramin/b86557ae81cbd019fcb9e071abe594de to your computer and use it in GitHub Desktop.

Revisions

  1. yawaramin revised this gist Aug 27, 2017. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions sig
    Original file line number Diff line number Diff line change
    @@ -3,13 +3,6 @@
    # Works with merlin version 2.5.4. Using protocol described at
    # https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking

    # Reason syntax tweaks (untested, but should work):
    #
    # L20: echo '["tell","start","end","module It = {' >$it
    # L22: echo '}; let () = ();"]' >>$it
    # L25: ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","{//' -e 's/};"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    # /g' | sed -e '/^ *$/d' -e 's/^ //'

    usage ()
    {
    echo Usage: either of the following will work:
    @@ -31,3 +24,10 @@ echo '["type","expression","It","at","end"]' >>$it

    ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","sig *//' -e 's/ *end"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    /g' | sed -e '/^ *$/d' -e 's/^ //'

    # Reason syntax tweaks (untested, but should work):
    #
    # L20: echo '["tell","start","end","module It = {' >$it
    # L22: echo '}; let () = ();"]' >>$it
    # L25: ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","{//' -e 's/};"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    # /g' | sed -e '/^ *$/d' -e 's/^ //'
  2. yawaramin revised this gist Aug 27, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions sig
    Original file line number Diff line number Diff line change
    @@ -5,10 +5,10 @@

    # Reason syntax tweaks (untested, but should work):
    #
    # L20: `echo '["tell","start","end","module It = {' >$it`
    # L22: `echo '}; let () = ();"]' >>$it`
    # L25: `ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","{//' -e 's/};"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    # /g' | sed -e '/^ *$/d' -e 's/^ //'`
    # L20: echo '["tell","start","end","module It = {' >$it
    # L22: echo '}; let () = ();"]' >>$it
    # L25: ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","{//' -e 's/};"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    # /g' | sed -e '/^ *$/d' -e 's/^ //'

    usage ()
    {
  3. yawaramin revised this gist Aug 27, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions sig
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,13 @@
    # Works with merlin version 2.5.4. Using protocol described at
    # https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking

    # Reason syntax tweaks (untested, but should work):
    #
    # L20: `echo '["tell","start","end","module It = {' >$it`
    # L22: `echo '}; let () = ();"]' >>$it`
    # L25: `ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","{//' -e 's/};"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    # /g' | sed -e '/^ *$/d' -e 's/^ //'`

    usage ()
    {
    echo Usage: either of the following will work:
  4. yawaramin revised this gist Aug 27, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions sig
    Original file line number Diff line number Diff line change
    @@ -22,5 +22,5 @@ sed 's/"/\\"/g' ${1%i} >>$it
    echo ' end let () = ()"]' >>$it
    echo '["type","expression","It","at","end"]' >>$it

    ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","//' -e 's/"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    /g'
    ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","sig *//' -e 's/ *end"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    /g' | sed -e '/^ *$/d' -e 's/^ //'
  5. yawaramin revised this gist Aug 27, 2017. 1 changed file with 2 additions and 6 deletions.
    8 changes: 2 additions & 6 deletions sig
    Original file line number Diff line number Diff line change
    @@ -5,22 +5,18 @@

    usage ()
    {
    echo Usage: all of the following will work:
    echo Usage: either of the following will work:
    echo
    echo ML syntax:
    echo ' sig module.ml'
    echo ' sig module.mli'
    echo RE syntax:
    echo ' sig module.re'
    echo ' sig module.rei'

    exit 1
    }

    [ -z "$1" ] && usage

    it=~/tmp/it

    touch $it
    echo '["tell","start","end","module It = struct' >$it
    sed 's/"/\\"/g' ${1%i} >>$it
    echo ' end let () = ()"]' >>$it
  6. yawaramin revised this gist Aug 27, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions sig
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    #!/usr/bin/env sh

    # Works with merlin version 2.5.4. Using protocol described at
    # https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking

    usage ()
    {
    echo Usage: all of the following will work:
  7. yawaramin created this gist Aug 27, 2017.
    27 changes: 27 additions & 0 deletions sig
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/usr/bin/env sh

    usage ()
    {
    echo Usage: all of the following will work:
    echo
    echo ML syntax:
    echo ' sig module.ml'
    echo ' sig module.mli'
    echo RE syntax:
    echo ' sig module.re'
    echo ' sig module.rei'
    exit 1
    }

    [ -z "$1" ] && usage

    it=~/tmp/it

    touch $it
    echo '["tell","start","end","module It = struct' >$it
    sed 's/"/\\"/g' ${1%i} >>$it
    echo ' end let () = ()"]' >>$it
    echo '["type","expression","It","at","end"]' >>$it

    ocamlmerlin <$it | sed -e '/^\["return",true\]$/d' -e 's/^\["return","//' -e 's/"\]$//' -e 's/\\"/"/g' -e 's/\\n/\
    /g'