Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:25:56+00:00 2026-06-01T11:25:56+00:00

I have 3 files: 1) cpf0.ml type string = char list type url =

  • 0

I have 3 files:

1) cpf0.ml

type string = char list
type url = string
type var = string
type name = string
type symbol =
| Symbol_name of name

2) problem.ml:

type symbol =
  | Ident of string

3) test.ml

open Problem;;
open Cpf0;;

let symbol b = function
  | Symbol_name n -> Ident n

When I combine test.ml: ocamlc -c test.ml.
I received an error:

This expression has type Cpf0.name = char list
but an expression was expected of type string

Could you please help me to correct it? Thank you very much

EDIT: Thank you for your answer. I want to explain more about these 3 files:
Because I am working with extraction in Coq to Ocaml type: cpf0.ml is generated from
cpf.v :

 Require Import String.
 Definition string := string.
 Definition name := string.
 Inductive symbol := 
  | Symbol_name : name -> symbol.

The code extraction.v:

Set Extraction Optimize.
Extraction Language Ocaml.
Require ExtrOcamlBasic ExtrOcamlString.
Extraction Blacklist cpf list.

where ExtrOcamlString

I opened: open Cpf0;; in problem.ml, and I got a new problem because in problem.ml they have another definition for type string

This expression has type Cpf0.string = char list
but an expression was expected of type Util.StrSet.elt = string

Here is a definition in util.ml defined type string:

module Str = struct type t = string end;;
module StrOrd = Ord.Make (Str);;
module StrSet = Set.Make (StrOrd);;
module StrMap = Map.Make (StrOrd);;

let set_add_chk x s =
  if StrSet.mem x s then failwith (x ^ " already declared")
  else StrSet.add x s;;

I was trying to change t = string to t = char list, but if I do that I have to change a lot of function it depend on (for example: set_add_chk above). Could you please give me a good idea? how I would do in this case.

EDIT 2: I am sorry to edit this question many times. After follow the answer, I fixed the file problem.ml

type symbol =
  | Ident of Cpf0.string

In problem.ml they have another definition like this. And the type one again does not accepted.

module SymbSet = Set.Make (SymbOrd);;
let rec ident_of_symbol = function
  | Ident s -> s

let idents_of_symbols s =
  SymbSet.fold (fun f s -> StrSet.add (ident_of_symbol f) s) s StrSet.empty;;

This expression has type Cpf0.string = char list but an expression was expected of type Util.StrSet.elt = string

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:25:57+00:00Added an answer on June 1, 2026 at 11:25 am

    You need to open module Cpf0 in problem.ml because the type string in modules Cfp0 and Problem is not the same.

    problem.ml:

    open Cpf0
    type symbol =
      | Ident of string
    

    or better, don’t open the module and prefix the type string like this:

    type symbol =
      | Ident of Cpf0.string
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Android, assuming that I have files in /data/data/package.name/, without knowing the names or
Hi i got a problem with changing urls. I have files: cat-art.php (cat- category,
I have a rake task that uploads a list of files via ftp. Copying
my problem is too complex now i have files table I selected from it
i have files in c:\MyData for example: demo.txt test.ini COUNT030.flg COUNT011.flg COUNT020.flg COUNT031.flg COUNT045.flg
I have a directory of files for which I'd like to do in-place string
Greetings. I have files that contains eleven fields in the file name. Each file
I have the following list of URLs to rewrite: 1 write url /products/ client
I have files served like so: AJAX request handler -> Include file I would
I have files which have many empty cells which appear as NaNs when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.